From: "Carlos Martín Nieto" <cmn@elego.de>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCH 2/2] cmd_clone: make sure repo is allocated on the heap and free it
Date: Thu, 31 Mar 2011 17:10:42 +0200 [thread overview]
Message-ID: <1301584242-3193-2-git-send-email-cmn@elego.de> (raw)
In-Reply-To: <1301584242-3193-1-git-send-email-cmn@elego.de>
Make sure that the buffer repo points to is in the heap and free it
afterwards.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
---
builtin/clone.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/builtin/clone.c b/builtin/clone.c
index fe0408c..697b1bf 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -415,7 +415,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
else if (!strchr(repo_name, ':'))
die("repository '%s' does not exist", repo_name);
else
- repo = repo_name;
+ repo = xstrdup(repo_name);
is_local = path && !is_bundle;
if (is_local && option_depth)
warning("--depth is ignored in local clones; use file:// instead.");
@@ -667,6 +667,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
free(dir);
free(path);
+ free(repo);
strbuf_release(&reflog_msg);
strbuf_release(&branch_top);
strbuf_release(&key);
--
1.7.4.1
prev parent reply other threads:[~2011-03-31 15:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Carlos Martín Nieto [this message]
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=1301584242-3193-2-git-send-email-cmn@elego.de \
--to=cmn@elego.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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).