2011.05.30 06:54 "[Tiff] tiff-4.0.0beta7: fix/mark a few minor bugs", by Jim Meyering

2011.05.30 06:33 "[Tiff] [PATCH] tiff2ps: avoid NULL-dereference on allocation failure", by Jim Meyering

coverity spotted the potential NULL-deref:

2011-05-30  Jim Meyering  <meyering@redhat.com>

tiff2ps: avoid NULL-dereference on allocation failure * tools/tiff2ps.c (PSDataBW): Zero buffer *after* checking for allocation failure, not before.

diff --git a/tools/tiff2ps.c b/tools/tiff2ps.c

index 1b553c2..27901b9 100644

--- a/tools/tiff2ps.c
+++ b/tools/tiff2ps.c

@@ -2595,13 +2595,14 @@ PSDataBW(FILE* fd, TIFF* tif, uint32 w, uint32 h)

        (void) w; (void) h;
        tf_buf = (unsigned char *) _TIFFmalloc(stripsize);

-       // FIXME
-        memset(tf_buf, 0, stripsize);

        if (tf_buf == NULL) {
                TIFFError(filename, "No space for scanline buffer");

        return;
}

+ // FIXME

+
 #if defined( EXP_ASCII85ENCODER )
        if ( ascii85 ) {
            /*
--

1.7.5.2.660.g9f46c