diff --git a/src/ChangeLog b/src/ChangeLog index ef6ea7e5..9d6e2998 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2014-11-19 Darshit Shah + + * main.c (format_and_print_line): Fix potential memory leak + 2014-11-19 Darshit Shah * utils.c (compile_posix_regex): Fix memory leak due to unfreed regex diff --git a/src/main.c b/src/main.c index d00324dd..530f9e8e 100644 --- a/src/main.c +++ b/src/main.c @@ -891,7 +891,10 @@ format_and_print_line (const char *prefix, const char *line, remaining_chars = line_length - TABULATION; } if (printf ("%s ", token) < 0) - return -1; + { + xfree_null (line_dup); + return -1; + } remaining_chars -= strlen (token) + 1; /* account for " " */ token = strtok (NULL, " "); }