main.c: Fix two potential memory leaks

Reported by: Coverity bug 1188048
This commit is contained in:
Darshit Shah 2015-03-01 12:48:08 +05:30
parent 735cc220e3
commit 7d5a7ef9ca
1 changed files with 8 additions and 2 deletions

View File

@ -875,7 +875,10 @@ format_and_print_line (const char *prefix, const char *line,
line_dup = xstrdup (line);
if (printf ("%s", prefix) < 0)
return -1;
{
xfree (line_dup);
return -1;
}
/* Wrap to new line after prefix. */
remaining_chars = 0;
@ -903,7 +906,10 @@ format_and_print_line (const char *prefix, const char *line,
}
if (printf ("\n") < 0)
return -1;
{
xfree (line_dup);
return -1;
}
xfree (line_dup);
return 0;