about summary refs log tree commit diff
path: root/converter/other/pgmtoppm.c
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2021-10-06 02:27:05 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2021-10-06 02:27:05 +0000
commit32205e919627a931b98986c661b4df2741e76754 (patch)
treeba9f3037277fcf1ccc2ccf35f256b21387534988 /converter/other/pgmtoppm.c
parent73a1918bd9eaca20d92b9afbfceda5254b77fc39 (diff)
downloadnetpbm-mirror-32205e919627a931b98986c661b4df2741e76754.tar.gz
netpbm-mirror-32205e919627a931b98986c661b4df2741e76754.tar.xz
netpbm-mirror-32205e919627a931b98986c661b4df2741e76754.zip
Fix bug in previous commit
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4152 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/other/pgmtoppm.c')
-rw-r--r--converter/other/pgmtoppm.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/converter/other/pgmtoppm.c b/converter/other/pgmtoppm.c
index 6c3e60f3..dea6c4ca 100644
--- a/converter/other/pgmtoppm.c
+++ b/converter/other/pgmtoppm.c
@@ -85,6 +85,9 @@ parseCommandLine(int argc, const char ** argv,
             pm_error("You may not specify -black or -white "
                      "together with -map");
 
+        cmdlineP->colorBlack = NULL;
+        cmdlineP->colorWhite = NULL;
+
         /* No color argument; only argument is file name */
         if (argc-1 < 1)
             cmdlineP->inputFilename = "-";
@@ -157,8 +160,10 @@ parseCommandLine(int argc, const char ** argv,
 static void
 freeCommandLine(struct CmdlineInfo const cmdline) {
 
-    pm_strfree(cmdline.colorBlack);
-    pm_strfree(cmdline.colorWhite);
+    if (cmdline.colorBlack)
+        pm_strfree(cmdline.colorBlack);
+    if (cmdline.colorWhite)
+        pm_strfree(cmdline.colorWhite);
 }