751dd227b9
Constanzo, #157106, #157118) - proper read longs and shorts in libpm.c (David Constanzo, #157110) - fix segfault in bmptopnm caused by freeing an uninitialized pointer
30 lines
1.1 KiB
Diff
30 lines
1.1 KiB
Diff
--- netpbm-10.27/converter/other/bmptopnm.c.bmptopnm 2005-05-09 10:06:05.707795976 +0200
|
|
+++ netpbm-10.27/converter/other/bmptopnm.c 2005-05-09 10:29:30.498235368 +0200
|
|
@@ -932,7 +932,7 @@ readBmp(FILE * const ifP,
|
|
xel ** const colormapP,
|
|
bool const verbose) {
|
|
|
|
- xel * colormap; /* malloc'ed */
|
|
+ xel * colormap = NULL; /* malloc'ed */
|
|
unsigned int pos;
|
|
|
|
/* The following are all information from the BMP headers */
|
|
@@ -1081,7 +1081,7 @@ main(int argc, char ** argv) {
|
|
parse_command_line(argc, argv, &cmdline);
|
|
|
|
ifP = pm_openr(cmdline.input_filespec);
|
|
- if (strcmp(cmdline.input_filespec, "-"))
|
|
+ if (!strcmp(cmdline.input_filespec, "-"))
|
|
ifname = "Standard Input";
|
|
else
|
|
ifname = cmdline.input_filespec;
|
|
@@ -1106,7 +1106,7 @@ main(int argc, char ** argv) {
|
|
writeRaster(BMPraster, cols, rows, outputType, cBitCount, pixelformat,
|
|
colormap);
|
|
|
|
- free(colormap);
|
|
+ if (colormap) free(colormap);
|
|
free(BMPraster);
|
|
|
|
exit(0);
|