From: VMware, Inc <> Date: Thu, 18 Nov 2010 21:39:23 +0000 (-0800) Subject: Unref the default glib context when quitting. X-Git-Tag: 2010.11.17-327185~63 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0cdeb245cb0ead5090095a5887b6457bc0239e52;p=thirdparty%2Fopen-vm-tools.git Unref the default glib context when quitting. After some digging, I found out why valgrind was complaining about memory leaks: creating a main loop using the default glib GMainContext creates an implicit reference to that context, that needs to be properly freed. This way, all GSources attached to that context are properly destroyed. Signed-off-by: Marcelo Vanzin --- diff --git a/open-vm-tools/services/vmtoolsd/mainLoop.c b/open-vm-tools/services/vmtoolsd/mainLoop.c index 5f8937d85..7bf9de8c2 100644 --- a/open-vm-tools/services/vmtoolsd/mainLoop.c +++ b/open-vm-tools/services/vmtoolsd/mainLoop.c @@ -373,6 +373,7 @@ ToolsCore_Setup(ToolsServiceState *state) state->ctx.errorCode = EXIT_SUCCESS; state->ctx.mainLoop = g_main_loop_new(gctx, TRUE); state->ctx.isVMware = VmCheck_IsVirtualWorld(); + g_main_context_unref(gctx); g_type_init(); state->ctx.serviceObj = g_object_new(TOOLSCORE_TYPE_SERVICE, NULL);