X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=utils%2Fminixpm.c;h=8fe3eac64a28a8c1efbe89e7bb23f2e3384f2eb9;hb=8afc01a67be4fbf3f1cc0fce9adf01b5289a21c6;hp=247eca89efc723ac05c7455e855ffaab1a91c317;hpb=ec8d2b32b63649e6d32bdfb306eda062769af823;p=xscreensaver diff --git a/utils/minixpm.c b/utils/minixpm.c index 247eca89..8fe3eac6 100644 --- a/utils/minixpm.c +++ b/utils/minixpm.c @@ -1,4 +1,4 @@ -/* xscreensaver, Copyright (c) 2001-2006 Jamie Zawinski +/* xscreensaver, Copyright (c) 2001-2013 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -190,17 +190,23 @@ minixpm_to_ximage (Display *dpy, Visual *visual, Colormap colormap, int depth, ximage = XCreateImage (dpy, visual, depth, (depth == 1 ? XYBitmap : ZPixmap), 0, 0, w, h, 8, 0); - if (! ximage) return 0; + if (! ximage) + { + if (pixels) free (pixels); + return 0; + } ximage->bitmap_bit_order = ximage->byte_order = (bigendian() ? MSBFirst : LSBFirst); ximage->data = (char *) calloc (ximage->height, ximage->bytes_per_line); - if (!ximage->data) { - XDestroyImage (ximage); - return 0; - } + if (!ximage->data) + { + XDestroyImage (ximage); + if (pixels) free (pixels); + return 0; + } w8 = (w + 7) / 8; if (mask_ret)