Closed ityuhui closed 3 years ago
/cc @brendandburns
Hi @brendandburns
Could you please review this PR if you have time ?
/lgtm /approve
(many apologies for the delay!)
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: brendandburns, ityuhui
The full list of commands accepted by this bot can be found here.
The pull request process is described here
It doesn’t matter. Thank you @brendandburns
The valgrind test reports a memory leak for the example delete_pod
The reason is: Deleting a pod successfully will return a
v1_pod_t
other than av1_status_t
from Kubernetes API server, but the generated client code still wants to parse the JSON string to create av1_status_t
in the functionv1_status_parseFromJSON
, the detail can refer to https://github.com/kubernetes-client/c/issues/31#issuecomment-704321954v1_status_t *v1_status_parseFromJSON(cJSON *v1_statusJSON)
will return NULL because the parameterv1_statusJSON
is not a validv1_status_t
JSON, butmetadata_local_nonprim
(member of v1_status_t) is created and its memory is not released before the function returns, this will cause memory leak.I fixed the issue by this PR in the openapi-generator repo, now re-generate the C client to merge the fix.
After this fix, valgrind does not reports memory leak: