]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Unref the default glib context when quitting.
authorVMware, Inc <>
Thu, 18 Nov 2010 21:39:23 +0000 (13:39 -0800)
committerMarcelo Vanzin <mvanzin@vmware.com>
Thu, 18 Nov 2010 21:39:23 +0000 (13:39 -0800)
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 <mvanzin@vmware.com>
open-vm-tools/services/vmtoolsd/mainLoop.c

index 5f8937d85854e18f4c0d4262357e0cf402a99c53..7bf9de8c2e6ed2dfabff428e20a2b0f8ad366979 100644 (file)
@@ -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);