diff options
Diffstat (limited to 'lib/gui/png_lode.c')
-rw-r--r-- | lib/gui/png_lode.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/gui/png_lode.c b/lib/gui/png_lode.c index 477704d976..e30db0f853 100644 --- a/lib/gui/png_lode.c +++ b/lib/gui/png_lode.c @@ -46,15 +46,16 @@ struct image *png_open(char *inbuf, int insize) LodePNGState state; int ret; unsigned error; - struct image *img = calloc(1, sizeof(struct image)); - unsigned char *png; - - if (!img) - return ERR_PTR(-ENOMEM); + struct image *img; + unsigned char *png = NULL; ret = png_uncompress_init(); if (ret) - goto err; + return ERR_PTR(ret); + + img = calloc(1, sizeof(struct image)); + if (!img) + return ERR_PTR(-ENOMEM); lodepng_state_init(&state); |