netpbm/netpbm-10.27-bmptopnm.patch

21 lines
763 B
Diff
Raw Normal View History

--- netpbm-10.32/converter/other/bmptopnm.c.bmptopnm 2006-02-27 15:02:02.000000000 +0100
+++ netpbm-10.32/converter/other/bmptopnm.c 2006-02-27 15:07:31.000000000 +0100
@@ -1248,7 +1248,7 @@ readBmp(FILE * const ifP,
xel ** const colormapP,
bool const verbose) {
- xel * colormap; /* malloc'ed */
+ xel * colormap = NULL; /* malloc'ed */
unsigned int pos;
/* Current byte position in the BMP file */
@@ -1455,7 +1455,7 @@ main(int argc, char ** argv) {
writeRasterGen(BMPraster, cols, rows, outputType, cBitCount,
pixelformat, colormap);
}
- free(colormap);
+ if (colormap) free(colormap);
free(BMPraster);
return 0;