about summary refs log tree commit diff
path: root/converter
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2011-09-24 19:56:21 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2011-09-24 19:56:21 +0000
commit65ee0017d381b2c98c98fc1bbffd388b78b62642 (patch)
tree39394376569d362b22595f60d228a9242cd19ff0 /converter
parentff4de95fcb6a03efbf1018f6f32bd044fd162907 (diff)
downloadnetpbm-mirror-65ee0017d381b2c98c98fc1bbffd388b78b62642.tar.gz
netpbm-mirror-65ee0017d381b2c98c98fc1bbffd388b78b62642.tar.xz
netpbm-mirror-65ee0017d381b2c98c98fc1bbffd388b78b62642.zip
cleanup
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@1569 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter')
-rw-r--r--converter/other/pstopnm.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/converter/other/pstopnm.c b/converter/other/pstopnm.c
index db42cb05..60ea2452 100644
--- a/converter/other/pstopnm.c
+++ b/converter/other/pstopnm.c
@@ -27,6 +27,7 @@
 #include <sys/stat.h>
 
 #include "pm_c_util.h"
+#include "mallocvar.h"
 #include "pnm.h"
 #include "shhopt.h"
 #include "nstring.h"
@@ -74,7 +75,7 @@ parseCommandLine(int argc, char ** argv,
    Note that the file spec array we return is stored in the storage that
    was passed to us as the argv array.
 -----------------------------------------------------------------------------*/
-    optEntry *option_def = malloc( 100*sizeof( optEntry ) );
+    optEntry * option_def;
         /* Instructions to pm_optParseOptions3 on how to parse our options.
          */
     optStruct3 opt;
@@ -87,6 +88,8 @@ parseCommandLine(int argc, char ** argv,
     unsigned int llxSpec, llySpec, urxSpec, urySpec;
     unsigned int xmaxSpec, ymaxSpec, xsizeSpec, ysizeSpec, dpiSpec;
     unsigned int textalphabitsSpec;
+
+    MALLOCARRAY_NOFAIL(option_def, 100);
     
     option_def_index = 0;   /* incremented by OPTENTRY */
     OPTENT3(0, "forceplain", OPT_FLAG,  NULL, &cmdlineP->forceplain,     0);
@@ -208,6 +211,8 @@ parseCommandLine(int argc, char ** argv,
     else 
         pm_error("Too many arguments (%d).  "
                  "Only need one: the Postscript file name", argc-1);
+
+    free(option_def);
 }
 
 
@@ -595,7 +600,7 @@ computePstrans(struct box       const box,
 static const char *
 computeOutfileArg(struct cmdlineInfo const cmdline) {
 
-    const char *retval;  /* malloc'ed */
+    const char * retval;  /* malloc'ed */
 
     if (cmdline.goto_stdout)
         retval = strdup("-");
@@ -661,7 +666,7 @@ findGhostscriptProg(const char ** const retvalP) {
         *retvalP = strdup(getenv("GHOSTSCRIPT"));
     if (*retvalP == NULL) {
         if (getenv("PATH") != NULL) {
-            char *pathwork;  /* malloc'ed */
+            char * pathwork;  /* malloc'ed */
             const char * candidate;
 
             pathwork = strdup(getenv("PATH"));