THRIFT-5157 Fix memory leak in c_glib unit tests
Client: c_glib
Patch: wangyunjian
Signed-off-by: wangyunjian <wangyunjian@huawei.com>
diff --git a/test/c_glib/src/test_server.c b/test/c_glib/src/test_server.c
index 0819b8c..c949530 100644
--- a/test/c_glib/src/test_server.c
+++ b/test/c_glib/src/test_server.c
@@ -131,6 +131,8 @@
&argv,
&error) == FALSE) {
fprintf (stderr, "%s\n", error->message);
+ g_clear_error (&error);
+ g_option_context_free (option_context);
return 255;
}
g_option_context_free (option_context);
@@ -282,11 +284,11 @@
if (!sigint_received) {
g_message ("thrift_server_serve: %s",
error != NULL ? error->message : "(null)");
- g_clear_error (&error);
}
puts ("done.");
+ g_clear_error (&error);
g_object_unref (server);
g_object_unref (protocol_factory);
g_object_unref (transport_factory);