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

[PATCH] fetch: do not leak a refspec

From
Jim Meyering <jim@meyering.net>
Date
Jun 8, 2011, 20:06 UTC
Message-ID
<87vcwgxf3q.fsf@rho.meyering.net>
Signed-off-by: Jim Meyering <meyering@redhat.com>
---
Coverity spotted this.
 builtin/fetch.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/builtin/fetch.c b/builtin/fetch.c
index f9c41da..93c9938 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -875,6 +875,7 @@ static int fetch_one(struct remote *remote, int argc, const char **argv)
 {
 	int i;
 	static const char **refs = NULL;
+	struct refspec *refspec;
 	int ref_nr = 0;
 	int exit_code;

@@ -915,8 +916,9 @@ static int fetch_one(struct remote *remote, int argc, const char **argv)

 	sigchain_push_common(unlock_pack_on_signal);
 	atexit(unlock_pack);
-	exit_code = do_fetch(transport,
-			parse_fetch_refspec(ref_nr, refs), ref_nr);
+	refspec = parse_fetch_refspec(ref_nr, refs);
+	exit_code = do_fetch(transport, refspec, ref_nr);
+	free(refspec);
 	transport_disconnect(transport);
 	transport = NULL;
 	return exit_code;
--
1.7.6.rc0.293.g40857
Next: Junio C Hamano
Message 1 of 2 in “fetch: do not leak a refspec”
  1. fetch: do not leak a refspecJim Meyering, Jun 8, 2011
  2. Junio C HamanoJun 9, 2011

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.