GNOME Bugzilla – Bug 479724
Memory leak upon calling "g_main_loop_run" in the secondary thread, while main loop is already running
Last modified: 2007-12-20 20:22:39 UTC
Please describe the problem: When g_main_loop_run is being called in the secondary thread, while g_main_loop_run was already called and loop is running, the following part of code is being executed: //********************************* ... if (!loop->context->cond) loop->context->cond = g_cond_new (); ... //********************************* This allocated condition is not being freed upon calling g_main_context_unref, and 48 bytes are being lost according to Valgrind. When POSIX threads are being used, g_cond_new () allocates internally a "pthread_cond_t" structure with sizeof(pthread_cond_t) = 48. Steps to reproduce: Actual results: Expected results: Does this happen every time? Other information: The detailed bug description can be found at: http://linuxtesting.org/results/report?num=D0005
Created attachment 96099 [details] The test case reproducing the bug
Created attachment 96100 [details] [review] Proposed patch, fixing the problem
2007-11-07 Matthias Clasen <mclasen@redhat.com> * glib/gmain.c (g_main_context_unref): Don't leak the condvar. (#479724, Areg Beketovski)