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
@ -2021,7 +2021,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
|
||||
const char *rfc = NULL;
|
||||
int creation_factor = -1;
|
||||
const char *signature = git_version_string;
|
||||
const char *signature_file_arg = NULL;
|
||||
char *signature_file_arg = NULL;
|
||||
struct keep_callback_data keep_callback_data = {
|
||||
.cfg = &cfg,
|
||||
.revs = &rev,
|
||||
@ -2559,6 +2559,8 @@ done:
|
||||
strbuf_release(&rdiff1);
|
||||
strbuf_release(&rdiff2);
|
||||
strbuf_release(&rdiff_title);
|
||||
free(description_file);
|
||||
free(signature_file_arg);
|
||||
free(to_free);
|
||||
free(rev.message_id);
|
||||
if (rev.ref_message_ids)
|
||||
|
Reference in New Issue
Block a user