Created by: ityuhui
If the type of element of an array is number, e.g.
"supplementalGroups": {
"description": "A list of groups applied to the first process run in each container, in addition to the container's primary GID. If unspecified, no groups will be added to any container.",
"items": {
"format": "int64",
"type": "integer"
},
"type": "array"
},
The current template code of CLibcurl will not allocate memory for the element before adding it to a list:
list_addElement(supplemental_groupsList , &supplemental_groups_local->valuedouble);
supplemental_groups_local
is a local variable, it will be released soon. And then the pointer pointing to supplemental_groups_local->valuedouble
will be invalid.
This PR allocates memory for the element:
double *supplemental_groups_local_value = (double *)calloc(1, sizeof(double));
if(!supplemental_groups_local_value)
{
goto end;
}
*supplemental_groups_local_value = supplemental_groups_local->valuedouble;
list_addElement(supplemental_groupsList , supplemental_groups_local_value);
PR checklist
-
Read the contribution guidelines. -
Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community. -
Run the following to build the project and update samples: ./mvnw clean package ./bin/generate-samples.sh ./bin/utils/export_docs_generators.sh
./bin/generate-samples.sh bin/configs/java*
. For Windows users, please run the script in Git BASH. -
File the PR against the master: master
,5.3.x
,6.0.x
-
If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.
Hi @wing328 @zhemant @michelealbano
Could you please review this PR ? Thanks.