[phonemgr] Call g_option_context_free () when context is no more needed



commit a44a72390ef9f2400b0f47d499254b71a1b41d3e
Author: Daniele Forsi <dforsi src gnome org>
Date:   Tue Dec 14 11:04:14 2010 +0100

    Call g_option_context_free () when context is no more needed
    
    Free the GOptionContext after use, this also fixes the following memleak:
    =10774== 275 (44 direct, 231 indirect) bytes in 1 blocks are definitely lost in loss record 55 of 217
    ==10774==    at 0x4024092: calloc (vg_replace_malloc.c:397)
    ==10774==    by 0x4D6320B: g_malloc0 (in /usr/lib/libglib-2.0.so.0.2000.1)
    ==10774==    by 0x4D67942: g_option_context_new (in /usr/lib/libglib-2.0.so.0.2000.1)
    ==10774==    by 0x80500B6: main (main.c:60)

 src/main.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/src/main.c b/src/main.c
index 3dcaeb0..8b607fd 100644
--- a/src/main.c
+++ b/src/main.c
@@ -65,8 +65,10 @@ main (int argc, char **argv)
 	if (g_option_context_parse (context, &argc, &argv, &error) == FALSE) {
 		g_error ("Couldn't parse options: %s", error->message);
 		g_error_free (error);
+		g_option_context_free (context);
 		return 1;
 	}
+	g_option_context_free (context);
 
 	if (version != FALSE) {
 		g_print (_("gnome-phone-manager version %s\n"), VERSION);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]