[Xfce4-commits] [apps/xfce4-terminal] 01/01: Check variable against NULL before using

noreply at xfce.org noreply at xfce.org
Tue Jan 8 18:02:45 CET 2019


This is an automated email from the git hooks/post-receive script.

f   2   4   0   4       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/xfce4-terminal.

commit d408db461a8487e912c71731cb7df7e17bda70e1
Author: Igor <f2404 at yandex.ru>
Date:   Tue Jan 8 12:02:18 2019 -0500

    Check variable against NULL before using
    
    Found with PVS-Studio.
---
 terminal/terminal-screen.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/terminal/terminal-screen.c b/terminal/terminal-screen.c
index 0dbe127..92e1586 100644
--- a/terminal/terminal-screen.c
+++ b/terminal/terminal-screen.c
@@ -1817,7 +1817,7 @@ terminal_screen_launch_child (TerminalScreen *screen)
   gchar       **argv;
   gchar       **env;
   gchar       **argv2;
-  guint         i;
+  guint         i, argc;
   VtePtyFlags   pty_flags = VTE_PTY_DEFAULT;
   GSpawnFlags   spawn_flags = G_SPAWN_CHILD_INHERITS_STDIN | G_SPAWN_SEARCH_PATH;
 
@@ -1839,7 +1839,8 @@ terminal_screen_launch_child (TerminalScreen *screen)
     {
       env = terminal_screen_get_child_environment (screen);
 
-      argv2 = g_new0 (gchar *, g_strv_length (argv) + 2);
+      argc = argv != NULL ? g_strv_length (argv) : 0;
+      argv2 = g_new0 (gchar *, argc + 2);
       argv2[0] = command;
 
       if (argv != NULL)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list