about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2015-06-28 14:19:25 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2015-06-28 14:19:25 +0000
commit781f3dbd8421b5ee5f1d638ab5229c58903be2b2 (patch)
treea2e3b421161ecbab2da9233c6d966c07d3df04f7
parentd096e37fad06341329e32ef8ef372a9d1041c29f (diff)
downloadnetpbm-mirror-781f3dbd8421b5ee5f1d638ab5229c58903be2b2.tar.gz
netpbm-mirror-781f3dbd8421b5ee5f1d638ab5229c58903be2b2.tar.xz
netpbm-mirror-781f3dbd8421b5ee5f1d638ab5229c58903be2b2.zip
suppress Valgrind error
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@2573 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r--converter/other/sgitopnm.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/converter/other/sgitopnm.c b/converter/other/sgitopnm.c
index 008d5376..6fd4efcf 100644
--- a/converter/other/sgitopnm.c
+++ b/converter/other/sgitopnm.c
@@ -28,6 +28,7 @@
 #include "pnm.h"
 #include "sgi.h"
 
+#define MAX_ZSIZE 256
 
 
 struct CmdlineInfo {
@@ -82,6 +83,10 @@ parseCommandLine(int argc, const char ** argv,
 
     free(option_def);
 
+    if (!cmdlineP->channelSpec)
+        cmdlineP->channel = MAX_ZSIZE + 1;
+            /* Invalid value; to suppress Valgrind error */
+
     if (argc-1 < 1)
         cmdlineP->inputFileName = "-";
     else if (argc-1 == 1)
@@ -212,7 +217,7 @@ readHeader(FILE *       const ifP,
     headP->xsize     = getBigShort(ifP);
     headP->ysize     = getBigShort(ifP);
     headP->zsize     = getBigShort(ifP);
-    if (headP->zsize > 256)
+    if (headP->zsize > MAX_ZSIZE)
         pm_error("Too many channels in input image: %u",
                  (unsigned int) headP->zsize );
     headP->pixmin    = getBigLong(ifP);