Re: [PATCH 1/2] builtin/checkout.c: don't leak memory in check_tracking_name

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 17, 2013 at 06:40:49PM -0700, Brandon Casey wrote:

> From: Brandon Casey <drafnel@xxxxxxxxx>
> 
> 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.

Thanks, looks obviously correct. I wonder if other callers of
remote_find_tracking make the same mistake. It looks like
check_tracking_branch does. And add_branch_for_removal. and
append_ref_to_tracked_list. Yeesh.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]