dtinfogen_worker: don't free variables then use them later.
authorJon Trulson <jon@radscan.com>
Sat, 31 Aug 2013 23:18:53 +0000 (17:18 -0600)
committerJon Trulson <jon@radscan.com>
Sat, 31 Aug 2013 23:18:53 +0000 (17:18 -0600)
In several places, variables were XFree()'d, but then used in system()
commands later.  This would cause various issues - on my system, I'd
get:

sh: 1: Syntax error: EOF in backquote substitution
system for rm failed; exiting...

while building the guides.

cde/programs/dtinfo/dtinfogen/infolib/etc/dtinfogen_worker.c

index 19d241d33f437b4c371bec485a9e65f6d5d0b30c..35b214846975bcafc3135bde88c725da3c773830 100644 (file)
@@ -1498,11 +1498,10 @@ buildBookcase(char *cmdSrc, char *dirName)
                        style_file, bookCaseName, bookCaseName);
       runShellCmd(cmd);
 
-      XtFree((char*)style_file);
-
       snprintf(cmd, sizeof(cmd), "rm -f %s", style_file);
       ret1 = system(cmd);
       if(ret1 != 0) die(-1, "system for rm failed; exiting...\n");
+      XtFree((char*)style_file);
     }
 
 
@@ -1519,11 +1518,10 @@ buildBookcase(char *cmdSrc, char *dirName)
                        compress_file, bookCaseName, bookCaseName);
       runShellCmd(cmd);
 
-      XtFree((char*)compress_file);
-
       snprintf(cmd, sizeof(cmd), "rm -f %s", compress_file);
       ret1 = system(cmd);
       if(ret1 != 0) die(-1, "system for rm failed; exiting...\n");
+      XtFree((char*)compress_file);
     }
 
 
@@ -1540,11 +1538,10 @@ buildBookcase(char *cmdSrc, char *dirName)
 
       runShellCmd(cmd);
 
-      XtFree((char*)anonym_file);
-
       snprintf(cmd, sizeof(cmd), "rm -f %s", anonym_file);
       ret1 = system(cmd);
       if(ret1 != 0) die(-1, "system for rm failed; exiting...\n");
+      XtFree((char*)anonym_file);
     }
 
     validateBookCase(bookCaseMap, bookCaseName);
@@ -1656,11 +1653,10 @@ storeBookCase(char *cmdSrc, char *tocOpt, char *dbName,
                        nsgmls_file, tocOpt, dbName, dirName, tmpFile);
       runShellCmd(cmd);
 
-      XtFree((char*)nsgmls_file);
-
       cmd = buildPath("rm -f %s", nsgmls_file);
       ret = system(cmd);
       if(ret != 0) die(-1, "system for rm failed; exiting...\n");
+      XtFree((char*)nsgmls_file);
     }
 
     XtFree(cmd);