tools/ttrace_parser: fix memory/resource leaks
tools/ttrace_parser/scripts/parse_dump.c:174]: (error) Memory leak: buffer
tools/ttrace_parser/scripts/parse_dump.c:201]: (error) Resource leak: file
@@ -171,6 +171,7 @@ static int read_tracebuffer(FILE *file, int bufsize)
read_len = fread(buffer, sizeof(char), bufsize, file);
if (read_len < 0) {
+ free_tracebuffer(buffer);
return INVALID;
}
@@ -198,6 +199,7 @@ int main(int argc, char **args)
filesize = get_dumpsize(file);
if (filesize <= 0) {
+ close_dump(file);
return INVALID;
}
