Skip to content

Commit bd8efe2

Browse files
authored
[C][Client] Allocate memory for the element of array when the type is number (OpenAPITools#10124)
1 parent 7dcca2e commit bd8efe2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

modules/openapi-generator/src/main/resources/C-libcurl/model-body.mustache

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,13 @@ fail:
666666
{
667667
goto end;
668668
}
669-
list_addElement({{{name}}}List , &{{{name}}}_local->valuedouble);
669+
double *{{{name}}}_local_value = (double *)calloc(1, sizeof(double));
670+
if(!{{{name}}}_local_value)
671+
{
672+
goto end;
673+
}
674+
*{{{name}}}_local_value = {{{name}}}_local->valuedouble;
675+
list_addElement({{{name}}}List , {{{name}}}_local_value);
670676
{{/isNumeric}}
671677
{{#isBoolean}}
672678
if(!cJSON_IsBool({{{name}}}_local))

0 commit comments

Comments
 (0)