Text  |   XML   |   Visible Warnings:

irssi-0.8.14 : irssi-0.8.14 analysis 2 : Leak  at fe-exec.c:329

Categories: ALLOC.LEAK CWE:401 CWE:771 CWE:773
Warning ID: 22017.28396
Procedure: process_exec
Trace: view
Modified: Thu Nov 26 11:09:21 2009   show details
 
Priority: None
State: None
Finding: None
Owner: None
  edit properties

Legend [ X ]
Warning Location
Contributes
Parse Error
Other Warning
Two or More Loop Iterations
On Execution Path
Comment
Macro
Preprocessor
Include
Keyword
Preprocessed Away

Source  |  Language: C Hide Legend     
ProblemLineSource
   /kat0/fletcher/SATE/2010/irssi-0.8.14/src/fe-common/core/fe-exec.c
   Enter process_exec
 284 static void process_exec(PROCESS_REC *rec, const char *cmd) 
 285 {
 286         const char *shell_args[4] = { "/bin/sh", "-c", NULL, NULL };
 287         char **args;
 288         int in[2], out[2];
 289         int n;
 290  
 291         if (pipe(in) == -1)
 292                 return;
 293         if (pipe(out) == -1)
 294                 return;
 295  
 296         shell_args[2] = cmd;
 297         rec->pid = fork();
 298         if (rec->pid == -1) {
 299                 /* error */ 
 300                 close(in[0]); close(in[1]);
 301                 close(out[0]); close(out[1]);
 302                 return;
 303         }
 304  
 305         if (rec->pid != 0) {
 306                 /* parent process */ 
 307                 GIOChannel *outio = g_io_channel_unix_new(in[1]);
 308  
 309                 rec->in = g_io_channel_unix_new(out[0]);
 310                 rec->out = net_sendbuffer_create(outio, 0);
 311  
 312                 close(out[1]);
 313                 close(in[0]);
 314                 pidwait_add(rec->pid);
 315                 return;
 316         }
 317  
 318         /* child process, try to clean up everything */ 
 319         setsid();
 320         setuid(getuid());
 321         setgid(getgid());
 322         signal(SIGINT, SIG_IGN);
 323         signal(SIGQUIT, SIG_DFL);
 324  
 325         putenv("TERM=tty");
 326  
 327         /* set stdin, stdout and stderr */ 
 328         dup2(in[0], STDIN_FILENO);   /* Ignored Return Value (ID: 7467.28566) */  /* Leak (ID: 22019.28398) */
allocated and leaked329         dup2(out[1], STDOUT_FILENO);     /* Leak */  /* Ignored Return Value (ID: 7466.28565) */
 330         dup2(out[1], STDERR_FILENO);   /* Leak (ID: 22018.28397) */
Postconditions
errno' != 0
shell_args[0]' = &#string19[0]
strlen(&shell_args[0])' = 8
shell_args[1]' = &#string20[0]
shell_args[2]' = cmd
shell_args[3]' = 0




Change Warning 22017.28396 : Leak

Priority:
State:
Finding:
Owner:
Note: