From 8057a17e5fc131b119ed37e66cf00f87d658edd7 Mon Sep 17 00:00:00 2001 From: Jiwoong Im Date: Wed, 30 Nov 2016 21:05:03 +0900 Subject: [PATCH] Fix memory leak in example codes Change-Id: I460a67233e1069c3f906c461f716d1596404eea0 Signed-off-by: Jiwoong Im --- example/get_async.c | 3 +++ example/set_async.c | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/example/get_async.c b/example/get_async.c index bd0ed80..89fc048 100644 --- a/example/get_async.c +++ b/example/get_async.c @@ -150,6 +150,7 @@ int main(int argc, char *argv[]) r = buxton_open(&cli, NULL, NULL); if (r) { perror("buxton_open"); + g_main_loop_unref(loop); return EXIT_FAILURE; } @@ -157,6 +158,7 @@ int main(int argc, char *argv[]) if (!layer) { perror("buxton_create_layer"); buxton_close(cli); + g_main_loop_unref(loop); return EXIT_FAILURE; } key = argv[2]; @@ -166,6 +168,7 @@ int main(int argc, char *argv[]) perror("buxton_get_value"); buxton_free_layer(layer); buxton_close(cli); + g_main_loop_unref(loop); return EXIT_FAILURE; } diff --git a/example/set_async.c b/example/set_async.c index 6a93a8c..71f5043 100644 --- a/example/set_async.c +++ b/example/set_async.c @@ -157,6 +157,7 @@ int main(int argc, char *argv[]) r = buxton_open(&cli, NULL, NULL); if (r) { perror("buxton_open"); + g_main_loop_unref(loop); return EXIT_FAILURE; } @@ -164,6 +165,7 @@ int main(int argc, char *argv[]) if (!layer) { perror("buxton_create_layer"); buxton_close(cli); + g_main_loop_unref(loop); return EXIT_FAILURE; } key = argv[2]; @@ -175,6 +177,7 @@ int main(int argc, char *argv[]) if (!val) { buxton_free_layer(layer); buxton_close(cli); + g_main_loop_unref(loop); return EXIT_FAILURE; } @@ -183,6 +186,7 @@ int main(int argc, char *argv[]) perror("buxton_set_value"); buxton_free_layer(layer); buxton_close(cli); + g_main_loop_unref(loop); return EXIT_FAILURE; } buxton_value_free(val); -- 2.7.4