[C][Client] Allocate memory for the element of array when the type is number (#10124)

This commit is contained in:
Hui Yu 2021-08-11 21:12:46 +08:00 committed by GitHub
parent 7dcca2e891
commit bd8efe2f91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -666,7 +666,13 @@ fail:
{
goto end;
}
list_addElement({{{name}}}List , &{{{name}}}_local->valuedouble);
double *{{{name}}}_local_value = (double *)calloc(1, sizeof(double));
if(!{{{name}}}_local_value)
{
goto end;
}
*{{{name}}}_local_value = {{{name}}}_local->valuedouble;
list_addElement({{{name}}}List , {{{name}}}_local_value);
{{/isNumeric}}
{{#isBoolean}}
if(!cJSON_IsBool({{{name}}}_local))