summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-06-27 21:29:46 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-06-27 21:29:46 (GMT)
commit9df9bdda3a2450fe97ba4db61ce4d46c81fbfc16 (patch)
treebd38118591f281343c33e9aa9f98428eef23cbb4 /builtin
parentfa4bf9edb9300da2688da8a920c506376a14de0a (diff)
parent9d58c4a3e3ce3a40262b7ff3cc39ce3b9a93d527 (diff)
downloadgit-9df9bdda3a2450fe97ba4db61ce4d46c81fbfc16.zip
git-9df9bdda3a2450fe97ba4db61ce4d46c81fbfc16.tar.gz
git-9df9bdda3a2450fe97ba4db61ce4d46c81fbfc16.tar.bz2
Merge branch 'bc/checkout-tracking-name-plug-leak'
Plug a small leak in checkout. * bc/checkout-tracking-name-plug-leak: t/t9802: explicitly name the upstream branch to use as a base builtin/checkout.c: don't leak memory in check_tracking_name
Diffstat (limited to 'builtin')
-rw-r--r--builtin/checkout.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c
index f5b50e5..3be0018 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -838,13 +838,16 @@ static int check_tracking_name(struct remote *remote, void *cb_data)
memset(&query, 0, sizeof(struct refspec));
query.src = cb->src_ref;
if (remote_find_tracking(remote, &query) ||
- get_sha1(query.dst, cb->dst_sha1))
+ get_sha1(query.dst, cb->dst_sha1)) {
+ free(query.dst);
return 0;
+ }
if (cb->dst_ref) {
+ free(query.dst);
cb->unique = 0;
return 0;
}
- cb->dst_ref = xstrdup(query.dst);
+ cb->dst_ref = query.dst;
return 0;
}