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



commit 2cbe5d42bc1962656981fc4499536a29f357948c
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()
    
    (cherry picked from commit 6fddffa7d7a9065d33157fbbf90ad1c989c5fed7)

 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 37fb8c2..587ed63 100644
--- a/src/connection-editor/page-general.c
+++ b/src/connection-editor/page-general.c
@@ -348,7 +348,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;
@@ -357,12 +356,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]