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



commit ccdbfec29d4ab0c0a4e7df8d13698e6b365751d2
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 3395eb9..db66bb5 100644
--- a/src/applet-vpn-request.c
+++ b/src/applet-vpn-request.c
@@ -147,6 +147,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 */
@@ -159,6 +161,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]