dtcreate: Fix double free inside ProcessExecString()
authorWilliam Schaub <wschaub@genesi-tech.com>
Sat, 11 Aug 2012 18:46:35 +0000 (14:46 -0400)
committerJon Trulson <jon@radscan.com>
Sun, 12 Aug 2012 01:33:22 +0000 (19:33 -0600)
cde/programs/dtcreate/parser.c

index 7886e0867473afe60c4a8b5ee5e2066f2f4baf79..a62476af89f9e8db75d918d66edf7918485270ea 100644 (file)
@@ -851,7 +851,7 @@ int  done=FALSE, argfound=FALSE,promptfound=FALSE;
                                              covers the complete string
                                              between %'s
                                             */
-                      if(argbuf) free(argbuf);
+                      if(argbuf) { free(argbuf); argbuf = NULL; }
                       if(s2)
                       {
                          argbuf = (char *)calloc(1,(s2-s1)+2);
@@ -877,7 +877,7 @@ int  done=FALSE, argfound=FALSE,promptfound=FALSE;
                 else if (s1 && *s1)
                 {
                      strcat(exec_args[0],s1);
-                     if(argbuf)   free(argbuf);
+                     if(argbuf)   { free(argbuf); argbuf = NULL; }
                      done = TRUE;
                      continue;
                 }
@@ -934,7 +934,7 @@ int  done=FALSE, argfound=FALSE,promptfound=FALSE;
                 argfound = FALSE;
                 s1=s2;
          }
-         if(argbuf) free(argbuf);
+         if(argbuf) { free(argbuf); argbuf = NULL; }
    return exec_args;
 }