git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] cmd_clone: free dir and path buffers
@ 2011-03-31 14:18 Carlos Martín Nieto
  2011-03-31 14:18 ` [PATCH 2/2] cmd_clone: make sure repo is allocated on the stack and free it Carlos Martín Nieto
  2011-03-31 14:45 ` [PATCH 1/2] cmd_clone: free dir and path buffers John Szakmeister
  0 siblings, 2 replies; 6+ messages in thread
From: Carlos Martín Nieto @ 2011-03-31 14:18 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

The variables dir and path are always allocated on the stack so it's
always safe to free them.

This memory would be freed by _exit, but it's good form to free memory
you've allocated.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
---

 This is a split-up version of an earlier patch. It's not a big deal,
but I had it in a local branch and I though I'd try to have it merged upstream.

 builtin/clone.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/builtin/clone.c b/builtin/clone.c
index 2ee1fa9..fe0408c 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -665,6 +665,8 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
 			err = run_command_v_opt(argv_submodule, RUN_GIT_CMD);
 	}
 
+	free(dir);
+	free(path);
 	strbuf_release(&reflog_msg);
 	strbuf_release(&branch_top);
 	strbuf_release(&key);
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-03-31 15:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-31 14:18 [PATCH 1/2] cmd_clone: free dir and path buffers Carlos Martín Nieto
2011-03-31 14:18 ` [PATCH 2/2] cmd_clone: make sure repo is allocated on the stack and free it Carlos Martín Nieto
2011-03-31 14:45 ` [PATCH 1/2] cmd_clone: free dir and path buffers John Szakmeister
2011-03-31 15:06   ` Carlos Martín Nieto
2011-03-31 15:10     ` Carlos Martín Nieto
2011-03-31 15:10       ` [PATCH 2/2] cmd_clone: make sure repo is allocated on the heap and free it Carlos Martín Nieto

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).