git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: git@vger.kernel.org
Cc: Derrick Stolee <derrickstolee@github.com>
Subject: [PATCH 1/4] list-objects-filter: don't memset after releasing filter struct
Date: Sun, 11 Sep 2022 00:58:09 -0400	[thread overview]
Message-ID: <Yx1q4crkHGNzwLhh@coredump.intra.peff.net> (raw)
In-Reply-To: <Yx1qwlpNbxGEiUgc@coredump.intra.peff.net>

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.

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;
 }
 
-- 
2.37.3.1242.g835d375f85


  reply	other threads:[~2022-09-11  4:58 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 ` Jeff King [this message]
2022-09-12 15:40   ` [PATCH 1/4] list-objects-filter: don't memset after releasing filter struct Junio C Hamano
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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=Yx1q4crkHGNzwLhh@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=derrickstolee@github.com \
    --cc=git@vger.kernel.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).