Fix potential memory leak in main.c

This commit is contained in:
Darshit Shah 2014-11-19 23:39:22 +05:30
parent 1ce1a40f94
commit f9646a0c14
2 changed files with 8 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2014-11-19 Darshit Shah <darnir@gmail.com>
* main.c (format_and_print_line): Fix potential memory leak
2014-11-19 Darshit Shah <darnir@gmail.com>
* utils.c (compile_posix_regex): Fix memory leak due to unfreed regex

View File

@ -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, " ");
}