Re: [PATCH 09/20] name-rev: don't xstrdup() an already dup'd string

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

 



René Scharfe <l.s.r@xxxxxx> writes:

>> -	tip_table.table[tip_table.nr].refname = xstrdup(refname);
>> +	tip_table.table[tip_table.nr].refname = shorten_unambiguous ? refname :
>> +		xstrdup(refname);
>
> Hmm, this works based on knowledge about the inner workings of
> name_ref_abbrev(), which provides the refname.  Could be cleaned up by
> inlining that short function, or by moving the xstrdup() call there.

Yeah, name_ref_abbrev() returns sometimes an allocated and some
other times a borrowed piece of memory, which is a poor design that
ignores memory ownership issues.  Luckily the function being touched
is the sole caller of it, and I agree with you that inlining may give
us a better fix.




[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]

  Powered by Linux