diff options
author | Christian Marangi <ansuelsmth@gmail.com> | 2023-05-26 19:10:43 +0200 |
---|---|---|
committer | Christian Marangi <ansuelsmth@gmail.com> | 2023-05-27 00:11:22 +0200 |
commit | b934ce815ff2d233a63d3edae2ba80ef4c271243 (patch) | |
tree | 5a4c3915b4ce4266a0104cdad29d236bbd6534f8 /program.c | |
parent | 11d5f8840002c29097fee78b300e1da986028721 (diff) |
program: fix memory leak in read_sourceinfo
Fix Coverty Scan CID 1521109 reporting a memory leak for path not freed
on read_size_t fail.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Diffstat (limited to 'program.c')
-rw-r--r-- | program.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -587,8 +587,11 @@ read_sourceinfo(uc_source_t *input, uint32_t flags, char **errp, uc_program_t *p return NULL; } - if (!read_size_t(input->fp, &len, sizeof(uint32_t), "sourceinfo code buffer length", errp)) + if (!read_size_t(input->fp, &len, sizeof(uint32_t), "sourceinfo code buffer length", errp)) { + free(path); + return NULL; + } if (len > 0) { code = xalloc(len); |