[network-manager-applet/bg/secret-timeout-bgo767321: 3/3] vpn-request: fix memory leak



commit ee2cf46c2ff34d3beaacccd583fadb0eadd5bdd3
Author: Beniamino Galvani <bgalvani redhat com>
Date:   Thu Jun 16 18:04:41 2016 +0200

    vpn-request: fix memory leak

 src/applet-vpn-request.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/src/applet-vpn-request.c b/src/applet-vpn-request.c
index b74e548..02de6ff 100644
--- a/src/applet-vpn-request.c
+++ b/src/applet-vpn-request.c
@@ -149,6 +149,8 @@ child_stdout_data_cb (GIOChannel *source, GIOCondition condition, gpointer user_
                return TRUE;
 
        if (g_io_channel_read_line (source, &str, NULL, NULL, NULL) == G_IO_STATUS_NORMAL) {
+               gs_free char *str_free = str;
+
                len = strlen (str);
                if (len == 1 && str[0] == '\n') {
                        /* on second line with a newline newline */
@@ -161,6 +163,7 @@ child_stdout_data_cb (GIOChannel *source, GIOCondition condition, gpointer user_
                        /* remove terminating newline */
                        str[len - 1] = '\0';
                        priv->lines = g_slist_append (priv->lines, str);
+                       str_free = NULL;
                }
        }
        return TRUE;


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