diff options
| author | Junio C Hamano <gitster@pobox.com> | 2024-11-13 08:35:30 +0900 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-11-13 08:35:31 +0900 |
| commit | 6890c99e38c378c2fff7747b52bd2102b403357d (patch) | |
| tree | 98d69bfd5256984c561ee7f3832ba04a283863ae /list-objects-filter-options.c | |
| parent | Merge https://github.com/j6t/git-gui (diff) | |
| parent | list-objects-filter-options: work around reported leak on error (diff) | |
| download | git-6890c99e38c378c2fff7747b52bd2102b403357d.tar.gz git-6890c99e38c378c2fff7747b52bd2102b403357d.zip | |
Merge branch 'ps/leakfixes-part-9'
More leakfixes.
* ps/leakfixes-part-9: (22 commits)
list-objects-filter-options: work around reported leak on error
builtin/merge: release output buffer after performing merge
dir: fix leak when parsing "status.showUntrackedFiles"
t/helper: fix leaking buffer in "dump-untracked-cache"
t/helper: stop re-initialization of `the_repository`
sparse-index: correctly free EWAH contents
dir: release untracked cache data
combine-diff: fix leaking lost lines
builtin/tag: fix leaking key ID on failure to sign
transport-helper: fix leaking import/export marks
builtin/commit: fix leaking cleanup config
trailer: fix leaking strbufs when formatting trailers
trailer: fix leaking trailer values
builtin/commit: fix leaking change data contents
upload-pack: fix leaking URI protocols
pretty: clear signature check
diff-lib: fix leaking diffopts in `do_diff_cache()`
revision: fix leaking bloom filters
builtin/grep: fix leak with `--max-count=0`
grep: fix leak in `grep_splice_or()`
...
Diffstat (limited to 'list-objects-filter-options.c')
| -rw-r--r-- | list-objects-filter-options.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/list-objects-filter-options.c b/list-objects-filter-options.c index 00611107d2..fa72e81e4a 100644 --- a/list-objects-filter-options.c +++ b/list-objects-filter-options.c @@ -252,16 +252,14 @@ void parse_list_objects_filter( const char *arg) { struct strbuf errbuf = STRBUF_INIT; - int parse_error; if (!filter_options->filter_spec.buf) BUG("filter_options not properly initialized"); if (!filter_options->choice) { + if (gently_parse_list_objects_filter(filter_options, arg, &errbuf)) + die("%s", errbuf.buf); strbuf_addstr(&filter_options->filter_spec, arg); - - parse_error = gently_parse_list_objects_filter( - filter_options, arg, &errbuf); } else { struct list_objects_filter_options *sub; @@ -271,18 +269,17 @@ void parse_list_objects_filter( */ transform_to_combine_type(filter_options); - strbuf_addch(&filter_options->filter_spec, '+'); - filter_spec_append_urlencode(filter_options, arg); ALLOC_GROW_BY(filter_options->sub, filter_options->sub_nr, 1, filter_options->sub_alloc); sub = &filter_options->sub[filter_options->sub_nr - 1]; list_objects_filter_init(sub); - parse_error = gently_parse_list_objects_filter(sub, arg, - &errbuf); + if (gently_parse_list_objects_filter(sub, arg, &errbuf)) + die("%s", errbuf.buf); + + strbuf_addch(&filter_options->filter_spec, '+'); + filter_spec_append_urlencode(filter_options, arg); } - if (parse_error) - die("%s", errbuf.buf); } int opt_parse_list_objects_filter(const struct option *opt, |
