diff options
author | Michael Drake <michael.drake@codethink.co.uk> | 2017-08-29 11:55:46 +0100 |
---|---|---|
committer | Michael Drake <michael.drake@codethink.co.uk> | 2017-08-29 11:55:46 +0100 |
commit | a9d18a8efd2ec114b1c08fc551a1347fd5befced (patch) | |
tree | 2a0e46ab4a8766fa64249fb5926ed18f2cce82a2 /content | |
parent | 41f30992aa92308a93c46fd8bdd80971e6e5e7e0 (diff) | |
download | netsurf-a9d18a8efd2ec114b1c08fc551a1347fd5befced.tar.gz netsurf-a9d18a8efd2ec114b1c08fc551a1347fd5befced.tar.bz2 |
Sprite content handler: Fix leaked rosprite_mem_context on rosprite_load error.
Diffstat (limited to 'content')
-rw-r--r-- | content/handlers/image/nssprite.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/content/handlers/image/nssprite.c b/content/handlers/image/nssprite.c index 530c95385..651714744 100644 --- a/content/handlers/image/nssprite.c +++ b/content/handlers/image/nssprite.c @@ -49,13 +49,13 @@ typedef struct nssprite_content { rosprite_error err = x; \ if (err == ROSPRITE_EOF) { \ LOG("Got ROSPRITE_EOF when loading sprite file"); \ - return false; \ + goto ro_sprite_error; \ } else if (err == ROSPRITE_BADMODE) { \ LOG("Got ROSPRITE_BADMODE when loading sprite file"); \ - return false; \ + goto ro_sprite_error; \ } else if (err == ROSPRITE_OK) { \ } else { \ - return false; \ + goto ro_sprite_error; \ } \ } while(0) @@ -96,7 +96,7 @@ static bool nssprite_convert(struct content *c) { nssprite_content *nssprite = (nssprite_content *) c; - struct rosprite_mem_context* ctx; + struct rosprite_mem_context* ctx = NULL; const char *data; unsigned long size; @@ -160,6 +160,13 @@ static bool nssprite_convert(struct content *c) content_set_status(c, ""); /* Done: update status bar */ return true; + +ro_sprite_error: + if (ctx != NULL) { + rosprite_destroy_mem_context(ctx); + } + + return false; } |