summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2023-05-27 00:36:42 +0200
committerGitHub <noreply@github.com>2023-05-27 00:36:42 +0200
commitb0baf043e64ca4d6cf80f371c23ec8581ecd5d59 (patch)
tree5a4c3915b4ce4266a0104cdad29d236bbd6534f8
parent11d5f8840002c29097fee78b300e1da986028721 (diff)
parentb934ce815ff2d233a63d3edae2ba80ef4c271243 (diff)
Merge pull request #152 from Ansuel/fix-memory-leak
program: fix memory leak in read_sourceinfo
-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);