[NetworkManager-libreswan/nm-1-0: 25/51] service: fix use-after-free in spawn_pty()



commit a6178e0c1d75e78ed13c07defae393434aab7595
Author: Lubomir Rintel <lkundrak v3 sk>
Date:   Thu Aug 27 15:55:20 2015 +0200

    service: fix use-after-free in spawn_pty()
    
    (cherry picked from commit 297b3d6790b762c0c25ce453d3b10920dde98ea4)

 src/nm-openswan-service.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/src/nm-openswan-service.c b/src/nm-openswan-service.c
index 487d0d4..40e56f3 100644
--- a/src/nm-openswan-service.c
+++ b/src/nm-openswan-service.c
@@ -779,7 +779,6 @@ spawn_pty (int *out_stdout,
                g_error ("PTY spawn: cannot exec '%s'", (char *) argv->pdata[0]);
                _exit (-1);
        }
-       g_ptr_array_free (argv, TRUE);
 
        /* Close child side's pipes */
        close (stderr_pipe[1]);
@@ -792,8 +791,10 @@ spawn_pty (int *out_stdout,
                g_set_error (error, NM_VPN_PLUGIN_ERROR, NM_VPN_PLUGIN_ERROR_LAUNCH_FAILED,
                             "PTY spawn failed for '%s' (%d)",
                             (char *) argv->pdata[0], child_pid);
+               g_ptr_array_free (argv, TRUE);
                return FALSE;
        }
+       g_ptr_array_free (argv, TRUE);
 
        /*  Set pipes non-blocking, so we can read big buffers
         *  in the callback without having to use FIONREAD


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