git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/4] list-objects-filter: don't memset after releasing filter struct

From
Jeff King <peff@peff.net>
Date
Sep 11, 2022, 04:58 UTC
Message-ID
<Yx1q4crkHGNzwLhh@coredump.intra.peff.net>
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
Previous: Jeff KingNext: Junio C Hamano
Message 2 of 11 in “list-objects-filter cleanups”
  1. 0/4 list-objects-filter cleanupsJeff King, Sep 11, 2022
  2. 1/4 list-objects-filter: don't memset after releasing filter structJeff King, Sep 11, 2022
  3. Junio C HamanoSep 12, 2022
  4. 2/4 list-objects-filter: handle null default filter specJeff King, Sep 11, 2022
  5. Junio C HamanoSep 12, 2022
  6. 3/4 list-objects-filter: add and use initializersJeff King, Sep 11, 2022
  7. 4/4 list-objects-filter: convert filter_spec to a strbufJeff King, Sep 11, 2022
  8. Derrick StoleeSep 19, 2022
  9. Jeff KingSep 19, 2022
  10. Jeff KingSep 11, 2022
  11. Derrick StoleeSep 19, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.