X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=xscreensaver;a=blobdiff_plain;f=utils%2Fminixpm.c;h=8fe3eac64a28a8c1efbe89e7bb23f2e3384f2eb9;hp=247eca89efc723ac05c7455e855ffaab1a91c317;hb=4ade52359b6eba3621566dac79793a33aa4c915f;hpb=ff35d056d723c9a5ffe728dbba5f1c25e141be04 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)