[phonemgr] build: fix memleaks found by Cppcheck 1.54



commit b7fc67a8f0be0c5789c786a6a818106c9ed089c8
Author: Daniele Forsi <dforsi src gnome org>
Date:   Sat Apr 28 16:53:09 2012 +0200

    build: fix memleaks found by Cppcheck 1.54
    
    Fixes:
    [libgsm/phonemgr-listener.c:1137]: (error) Memory leak: mstr
    [src/main.c:69]: (error) Memory leak: app

 libgsm/phonemgr-listener.c |    1 +
 src/main.c                 |    4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/libgsm/phonemgr-listener.c b/libgsm/phonemgr-listener.c
index 81d000e..e4fa169 100644
--- a/libgsm/phonemgr-listener.c
+++ b/libgsm/phonemgr-listener.c
@@ -1114,6 +1114,7 @@ phonemgr_listener_queue_message (PhonemgrListener *l,
 	} else if (error == GN_ERR_NOTREADY) {
 		g_message ("Can't send message, phone disconnected");
 		g_mutex_unlock (l->mutex);
+		g_free (mstr);
 		return;
 	}
 
diff --git a/src/main.c b/src/main.c
index 1d5deeb..1a3883a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -53,8 +53,6 @@ main (int argc, char **argv)
 	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
 	textdomain (GETTEXT_PACKAGE);
 
-	app = g_new0 (MyApp, 1);
-
 	context = g_option_context_new (N_("- Manage your mobile phone"));
 	g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);
 	g_option_context_set_translation_domain(context, GETTEXT_PACKAGE);
@@ -84,6 +82,8 @@ main (int argc, char **argv)
 
 	gconf_init (argc, argv, NULL);
 
+	app = g_new0 (MyApp, 1);
+
 	/* Setup the D-Bus object */
 	app->object = g_object_new (phonemgr_object_get_type (), NULL);
 



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