/pidgin/main: 04cf8cbe44d8: Remove more NULL-checks before free().

Michael McConville mmcco at mykolab.com
Mon Dec 21 14:50:53 EST 2015


Changeset: 04cf8cbe44d8706ab01c6767b9875e89ecb863c5
Author:	 Michael McConville <mmcco at mykolab.com>
Date:	 2015-12-21 14:50 -0500
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/04cf8cbe44d8

Description:

Remove more NULL-checks before free().

diffstat:

 pidgin/gtkmedia.c                     |   3 +--
 pidgin/gtkstatusbox.c                 |   7 ++-----
 pidgin/libpidgin.c                    |  18 ++++++------------
 pidgin/plugins/gestures/stroke-draw.c |   3 +--
 4 files changed, 10 insertions(+), 21 deletions(-)

diffs (78 lines):

diff --git a/pidgin/gtkmedia.c b/pidgin/gtkmedia.c
--- a/pidgin/gtkmedia.c
+++ b/pidgin/gtkmedia.c
@@ -1125,8 +1125,7 @@ pidgin_media_set_property (GObject *obje
 			break;
 		}
 		case PROP_SCREENNAME:
-			if (media->priv->screenname)
-				g_free(media->priv->screenname);
+			g_free(media->priv->screenname);
 			media->priv->screenname = g_value_dup_string(value);
 			break;
 		default:
diff --git a/pidgin/gtkstatusbox.c b/pidgin/gtkstatusbox.c
--- a/pidgin/gtkstatusbox.c
+++ b/pidgin/gtkstatusbox.c
@@ -2314,11 +2314,8 @@ activate_currently_selected_status(Pidgi
 	{
 		gtk_widget_hide(status_box->vbox);
 		status_box->webview_visible = FALSE;
-		if (message != NULL)
-		{
-			g_free(message);
-			message = NULL;
-		}
+		g_free(message);
+		message = NULL;
 	}
 
 	if (status_box->account == NULL) {
diff --git a/pidgin/libpidgin.c b/pidgin/libpidgin.c
--- a/pidgin/libpidgin.c
+++ b/pidgin/libpidgin.c
@@ -776,14 +776,10 @@ int pidgin_start(int argc, char *argv[])
 #ifdef USE_SM
 	pidgin_session_init(argv[0], opt_session_arg, opt_config_dir_arg);
 #endif
-	if (opt_session_arg != NULL) {
-		g_free(opt_session_arg);
-		opt_session_arg = NULL;
-	}
-	if (opt_config_dir_arg != NULL) {
-		g_free(opt_config_dir_arg);
-		opt_config_dir_arg = NULL;
-	}
+	g_free(opt_session_arg);
+	opt_session_arg = NULL;
+	g_free(opt_config_dir_arg);
+	opt_config_dir_arg = NULL;
 
 	/* This needs to be before purple_blist_show() so the
 	 * statusbox gets the forced online status. */
@@ -810,10 +806,8 @@ int pidgin_start(int argc, char *argv[])
 			purple_savedstatus_activate(purple_savedstatus_get_startup());
 		/* now enable the requested ones */
 		dologin_named(opt_login_arg);
-		if (opt_login_arg != NULL) {
-			g_free(opt_login_arg);
-			opt_login_arg = NULL;
-		}
+		g_free(opt_login_arg);
+		opt_login_arg = NULL;
 	} else if (opt_nologin)	{
 		/* Set all accounts to "offline" */
 		PurpleSavedStatus *saved_status;
diff --git a/pidgin/plugins/gestures/stroke-draw.c b/pidgin/plugins/gestures/stroke-draw.c
--- a/pidgin/plugins/gestures/stroke-draw.c
+++ b/pidgin/plugins/gestures/stroke-draw.c
@@ -321,8 +321,7 @@ gstroke_cleanup (GtkWidget *widget)
 
   metrics = (struct gstroke_metrics*)g_object_get_data(G_OBJECT(widget),
 													   GSTROKE_METRICS);
-  if (metrics)
-    g_free (metrics);
+  g_free(metrics);
   g_object_steal_data(G_OBJECT(widget), GSTROKE_METRICS);
 }
 



More information about the Commits mailing list