From 82fb962911daadc9da0b5fa5a92180aa2a82262e Mon Sep 17 00:00:00 2001 From: Hui Yu Date: Mon, 1 Jun 2020 12:00:58 +0000 Subject: [PATCH] [Examples] Fix memory leak in example/list_pod --- examples/exec_provider/list_pod_by_exec_provider.c | 2 ++ examples/list_pod/main.c | 2 ++ examples/list_pod_incluster/main.c | 2 ++ 3 files changed, 6 insertions(+) diff --git a/examples/exec_provider/list_pod_by_exec_provider.c b/examples/exec_provider/list_pod_by_exec_provider.c index 5a4e7d2..9f0c3d4 100644 --- a/examples/exec_provider/list_pod_by_exec_provider.c +++ b/examples/exec_provider/list_pod_by_exec_provider.c @@ -28,6 +28,8 @@ void list_pod(apiClient_t * apiClient) pod = listEntry->data; printf("\tThe pod name: %s\n", pod->metadata->name); } + v1_pod_list_free(pod_list); + pod_list = NULL; } else { printf("Cannot get any pod.\n"); } diff --git a/examples/list_pod/main.c b/examples/list_pod/main.c index 4ed94a9..1fdc926 100644 --- a/examples/list_pod/main.c +++ b/examples/list_pod/main.c @@ -28,6 +28,8 @@ void list_pod(apiClient_t * apiClient) pod = listEntry->data; printf("\tThe pod name: %s\n", pod->metadata->name); } + v1_pod_list_free(pod_list); + pod_list = NULL; } else { printf("Cannot get any pod.\n"); } diff --git a/examples/list_pod_incluster/main.c b/examples/list_pod_incluster/main.c index db31aaf..c51dfd5 100644 --- a/examples/list_pod_incluster/main.c +++ b/examples/list_pod_incluster/main.c @@ -29,6 +29,8 @@ void list_pod(apiClient_t * apiClient) pod = listEntry->data; printf("\tThe pod name: %s\n", pod->metadata->name); } + v1_pod_list_free(pod_list); + pod_list = NULL; } else { printf("Cannot get any pod.\n"); }