Skip to content

Commit

Permalink
Merge branch 'bc/checkout-tracking-name-plug-leak'
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Junio C Hamano committed Jun 27, 2013
2 parents fa4bf9e + 9d58c4a commit 9df9bdd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions builtin/checkout.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions t/t9802-git-p4-filetype.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ test_expect_success 'gitattributes setting eol=lf produces lf newlines' '
git init &&
echo "* eol=lf" >.gitattributes &&
git p4 sync //depot@all &&
git checkout master &&
git checkout -b master p4/master &&
test_cmp "$cli"/f-unix-orig f-unix &&
test_cmp "$cli"/f-win-as-lf f-win
)
Expand All @@ -109,7 +109,7 @@ test_expect_success 'gitattributes setting eol=crlf produces crlf newlines' '
git init &&
echo "* eol=crlf" >.gitattributes &&
git p4 sync //depot@all &&
git checkout master &&
git checkout -b master p4/master &&
test_cmp "$cli"/f-unix-as-crlf f-unix &&
test_cmp "$cli"/f-win-orig f-win
)
Expand Down

0 comments on commit 9df9bdd

Please sign in to comment.