builtin/checkout.c: don't leak memory in check_tracking_name
commit2c4842023205b4b2cf7eac973cd7dc2fca263327
authorBrandon Casey <drafnel@gmail.com>
Tue, 18 Jun 2013 01:40:49 +0000 (17 18:40 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 18 Jun 2013 14:25:06 +0000 (18 07:25 -0700)
treeec42b961eb123b907e371bcaef61866774123f09
parent77eb44b8ed601a17a5ec9b1fb8c4c53ba10aaa56
builtin/checkout.c: don't leak memory in check_tracking_name

remote_find_tracking() populates the query struct with an allocated
string in the dst member.  So, we do not need to xstrdup() the string,
since we can transfer ownership from the query struct (which will go
out of scope at the end of this function) to our callback struct, but
we must free the string if it will not be used so we will not leak
memory.

Let's do so.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/checkout.c