kubernetes-client / c

Official C client library for Kubernetes
Apache License 2.0
146 stars 46 forks source link

[BUG][Valgrind memcheck] Memory leak in example/list_pod #13

Closed ityuhui closed 4 years ago

ityuhui commented 4 years ago

Command:

valgrind --tool=memcheck --leak-check=full ./list_pod_bin

Result:

==8104== 5,965 (32 direct, 5,933 indirect) bytes in 1 blocks are definitely lost in loss record 83 of 83 ==8104== at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==8104== by 0x4EF3FB0: v1_pod_list_create (v1_pod_list.c:14) ==8104== by 0x4EF43FF: v1_pod_list_parseFromJSON (v1_pod_list.c:158) ==8104== by 0x502C8FB: CoreV1API_listNamespacedPod (CoreV1API.c:19442) ==8104== by 0x1089D4: list_pod (main.c:11) ==8104== by 0x108B3D: main (main.c:54)

ityuhui commented 4 years ago

The root cause is example/list_pod has not released the memory of v1_pod_list_t *pod_list. This is not an issue of libkubernetes.

ityuhui commented 4 years ago

This issue is fixed by the PR #16