1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

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

View File

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