[network-manager-applet] c-e: fix memleak of @zone in CEPageGeneral:ui_to_setting()



commit 6fddffa7d7a9065d33157fbbf90ad1c989c5fed7
Author: Thomas Haller <thaller redhat com>
Date:   Fri Sep 11 12:13:35 2015 +0200

    c-e: fix memleak of @zone in CEPageGeneral:ui_to_setting()

 src/connection-editor/page-general.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/src/connection-editor/page-general.c b/src/connection-editor/page-general.c
index 85b4d74..477c0be 100644
--- a/src/connection-editor/page-general.c
+++ b/src/connection-editor/page-general.c
@@ -373,7 +373,6 @@ static void
 ui_to_setting (CEPageGeneral *self)
 {
        CEPageGeneralPrivate *priv = CE_PAGE_GENERAL_GET_PRIVATE (self);
-       char *zone;
        char *uuid = NULL;
        GtkTreeIter iter;
        gboolean autoconnect = FALSE, everyone = FALSE;
@@ -382,12 +381,12 @@ ui_to_setting (CEPageGeneral *self)
         * are received from FirewallD asynchronously; got_zones indicates we are ready.
         */
        if (priv->got_zones) {
-               zone = gtk_combo_box_text_get_active_text (priv->firewall_zone);
-
-               if (g_strcmp0 (zone, FIREWALL_ZONE_DEFAULT) == 0)
-                       zone = NULL;
-               g_object_set (priv->setting, NM_SETTING_CONNECTION_ZONE, zone, NULL);
+               char *zone;
 
+               zone = gtk_combo_box_text_get_active_text (priv->firewall_zone);
+               g_object_set (priv->setting, NM_SETTING_CONNECTION_ZONE,
+                             (g_strcmp0 (zone, FIREWALL_ZONE_DEFAULT) != 0) ? zone : NULL,
+                             NULL);
                g_free (zone);
        }
 


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