summaryrefslogtreecommitdiffhomepage
path: root/program.c
diff options
context:
space:
mode:
authorChristian Marangi <ansuelsmth@gmail.com>2023-05-26 19:10:43 +0200
committerChristian Marangi <ansuelsmth@gmail.com>2023-05-27 00:11:22 +0200
commitb934ce815ff2d233a63d3edae2ba80ef4c271243 (patch)
tree5a4c3915b4ce4266a0104cdad29d236bbd6534f8 /program.c
parent11d5f8840002c29097fee78b300e1da986028721 (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.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/program.c b/program.c
index f347a35..abd525a 100644
--- a/program.c
+++ b/program.c
@@ -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);