diff options
author | Petr Machata <pmachata@redhat.com> | 2012-11-29 17:31:25 +0100 |
---|---|---|
committer | Petr Machata <pmachata@redhat.com> | 2012-11-29 17:31:25 +0100 |
commit | 21c4e357be309954c5daa6d5182d6fc4a346eb50 (patch) | |
tree | 7d31ae9ddf1fba6f3db5f5525219d74444255af2 /read_config_file.c | |
parent | f197727e6247be1ee08d2a667931aee20512ae18 (diff) | |
download | ltrace-21c4e357be309954c5daa6d5182d6fc4a346eb50.tar.gz |
Plug leaks in error paths of read_config_file
Now that there's a couple test cases exercising them, these are visible
in valgrind runs of the testsuite.
Diffstat (limited to 'read_config_file.c')
-rw-r--r-- | read_config_file.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/read_config_file.c b/read_config_file.c index 3624e90..e247436 100644 --- a/read_config_file.c +++ b/read_config_file.c @@ -435,13 +435,16 @@ parse_typedef(char **str) || !forward->forward)) { report_error(filename, line_no, "Redefinition of typedef '%s'", name); + free(name); return; } // Skip = sign eat_spaces(str); - if (parse_char(str, '=') < 0) + if (parse_char(str, '=') < 0) { + free(name); return; + } eat_spaces(str); struct typedef_node_t *this_td = new_typedef(name, NULL, 0); @@ -449,6 +452,7 @@ parse_typedef(char **str) if (this_td->info == NULL) { free(this_td); + free(name); return; } @@ -467,6 +471,8 @@ parse_typedef(char **str) type_destroy(this_td->info); free(this_td->info); } + free(this_td); + free(name); return; } |