diff options
| author | Patrick Steinhardt <ps@pks.im> | 2024-06-11 11:19:22 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-06-11 13:15:04 -0700 |
| commit | 14da26230a7644a2f9dfbc3f43d9d7ab6e0074e9 (patch) | |
| tree | 600341b6864236888a6508a79bf46e97436ded8b /builtin/fmt-merge-msg.c | |
| parent | 56931c4d89e7efe41dd96d230b8176e2d32a035d (diff) | |
| download | git-14da26230a7644a2f9dfbc3f43d9d7ab6e0074e9.tar.gz | |
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>
Diffstat (limited to 'builtin/fmt-merge-msg.c')
| -rw-r--r-- | builtin/fmt-merge-msg.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c index 0f9855b680..957786d1b3 100644 --- a/builtin/fmt-merge-msg.c +++ b/builtin/fmt-merge-msg.c @@ -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; } |
