From edaf7b669c0c5175443bcf1c19242b9918aa408f Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Thu, 4 Dec 2014 13:47:31 +0100 Subject: [PATCH] imlib_save_image(): Check loader return code for errors Prevents tons of: ==10646== Conditional jump or move depends on uninitialised value(s) ==10646== at 0x4F7D30C: png_write_find_filter (pngwutil.c:2578) ==10646== by 0x4F7568F: png_write_row (pngwrite.c:827) ==10646== by 0x4F751B0: png_write_rows (pngwrite.c:587) ==10646== by 0x4D40C7D: save (loader_png.c:373) ==10646== by 0x1297084: __imlib_SaveImage (image.c:1282) ==10646== by 0x124252B: imlib_save_image (api.c:4615) ==10646== by 0x401990: main (imlib2_conv.c:74) when trying to convert id:000134,src:000105,op:havoc,rep:32. --- src/lib/api.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/api.c b/src/lib/api.c index 3bb09ea..e924608 100644 --- a/src/lib/api.c +++ b/src/lib/api.c @@ -4603,7 +4603,8 @@ imlib_save_image(const char *filename) CHECK_PARAM_POINTER("imlib_save_image", "filename", filename); CAST_IMAGE(im, ctx->image); if ((!(im->data)) && (im->loader) && (im->loader->load)) - im->loader->load(im, NULL, 0, 1); + if (!im->loader->load(im, NULL, 0, 1)) + return; if (!im->data) return; prev_ctxt_image = ctx->image;