parse-options: fix leaks for users of OPT_FILENAME
The `OPT_FILENAME()` option will, if set, put an allocated string into the user-provided variable. Consequently, that variable thus needs to be free'd by the caller of `parse_options()`. Some callsites don't though and thus leak memory. Fix those. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
56931c4d89
commit
14da26230a
@ -11,7 +11,7 @@ static const char * const fmt_merge_msg_usage[] = {
|
||||
|
||||
int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)
|
||||
{
|
||||
const char *inpath = NULL;
|
||||
char *inpath = NULL;
|
||||
const char *message = NULL;
|
||||
char *into_name = NULL;
|
||||
int shortlog_len = -1;
|
||||
@ -66,5 +66,7 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)
|
||||
if (ret)
|
||||
return ret;
|
||||
write_in_full(STDOUT_FILENO, output.buf, output.len);
|
||||
|
||||
free(inpath);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user