From 864409ddce2739a10a2c614773b7e78537f74484 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Mon, 27 Oct 2008 03:33:30 +0000 Subject: Release 10.35.54 git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@762 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- converter/other/pnmtoddif.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'converter/other/pnmtoddif.c') diff --git a/converter/other/pnmtoddif.c b/converter/other/pnmtoddif.c index 65152865..962487f2 100644 --- a/converter/other/pnmtoddif.c +++ b/converter/other/pnmtoddif.c @@ -558,17 +558,20 @@ int main(int argc, char *argv[]) break; case PGM_TYPE: { - gray *pixels; - - pixels = (gray *) data; + gray *pixels = pgm_allocrow(cols); for (i = 0; i < rows; i++) { + p = data; pgm_readpgmrow(ifd, pixels, cols, maxval, format); + for (j = 0; j < cols; j++) { + *p++ = (unsigned char) pixels[j]; + } if (fwrite(data,1,ip.bytes_per_line,ofd) != ip.bytes_per_line) { perror("Writing image data\n"); exit(1); } } + pgm_freerow(pixels); } break; case PPM_TYPE: -- cgit 1.4.1