summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stapelberg <michael@stapelberg.de>2013-07-09 22:31:32 +0200
committerMichael Stapelberg <michael@stapelberg.de>2013-07-09 22:31:32 +0200
commite3887bd2d89876fcbd31edc75ea0848245ce2eed (patch)
treed558108373c8142480e4db358ff41dc25c4b2404
parent4f3d815089e9587bb5adcdb1c40fe3683113ea3d (diff)
Fix memory leak (Thanks psychon)
-rw-r--r--cursor/parse_cursor_file.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/cursor/parse_cursor_file.c b/cursor/parse_cursor_file.c
index 4e22451..2a5713d 100644
--- a/cursor/parse_cursor_file.c
+++ b/cursor/parse_cursor_file.c
@@ -134,8 +134,10 @@ int parse_cursor_file(xcb_cursor_context_t *c, const int fd, xcint_image_t **ima
chunk.version = le32toh(chunk.version);
/* Sanity check, as libxcursor does it. */
if (chunk.type != cf.tocs[n].type ||
- chunk.subtype != cf.tocs[n].subtype)
+ chunk.subtype != cf.tocs[n].subtype) {
+ free(cf.tocs);
return -EINVAL;
+ }
read(fd, i, sizeof(xcint_image_t) - sizeof(uint32_t*)); // TODO: better type
i->width = le32toh(i->width);
i->height = le32toh(i->height);