git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org, Derrick Stolee <derrickstolee@github.com>
Subject: Re: [PATCH 1/4] list-objects-filter: don't memset after releasing filter struct
Date: Mon, 12 Sep 2022 08:40:16 -0700	[thread overview]
Message-ID: <xmqq5yhsha8v.fsf@gitster.g> (raw)
In-Reply-To: <Yx1q4crkHGNzwLhh@coredump.intra.peff.net> (Jeff King's message of "Sun, 11 Sep 2022 00:58:09 -0400")

Jeff King <peff@peff.net> writes:

> If we see an error while parsing a "combine" filter, we call
> list_objects_filter_release() to free any allocated memory,
> and then use memset() to return the struct to a known state. But the
> release function already does that reinitializing. Doing it again is
> pointless.

Makes sense.

> Signed-off-by: Jeff King <peff@peff.net>
> ---
>  list-objects-filter-options.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/list-objects-filter-options.c b/list-objects-filter-options.c
> index 6cc4eb8e1c..ea989db260 100644
> --- a/list-objects-filter-options.c
> +++ b/list-objects-filter-options.c
> @@ -187,10 +187,8 @@ static int parse_combine_filter(
>  
>  cleanup:
>  	strbuf_list_free(subspecs);
> -	if (result) {
> +	if (result)
>  		list_objects_filter_release(filter_options);
> -		memset(filter_options, 0, sizeof(*filter_options));
> -	}
>  	return result;
>  }

  reply	other threads:[~2022-09-12 15:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-11  4:57 [PATCH 0/4] list-objects-filter cleanups Jeff King
2022-09-11  4:58 ` [PATCH 1/4] list-objects-filter: don't memset after releasing filter struct Jeff King
2022-09-12 15:40   ` Junio C Hamano [this message]
2022-09-11  5:00 ` [PATCH 2/4] list-objects-filter: handle null default filter spec Jeff King
2022-09-12 16:56   ` Junio C Hamano
2022-09-11  5:03 ` [PATCH 3/4] list-objects-filter: add and use initializers Jeff King
2022-09-11  5:03 ` [PATCH 4/4] list-objects-filter: convert filter_spec to a strbuf Jeff King
2022-09-19 17:50   ` Derrick Stolee
2022-09-19 19:05     ` Jeff King
2022-09-11  5:07 ` [PATCH 0/4] list-objects-filter cleanups Jeff King
2022-09-19 17:51 ` Derrick Stolee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq5yhsha8v.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=derrickstolee@github.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).