Re: [PATCH] archive: release refname after use

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

 



On Sat, Nov 14, 2020 at 11:01:04PM +0100, René Scharfe wrote:

> parse_treeish_arg() uses dwim_ref() to set refname to a strdup'd string.
> Release it after use.  Also remove the const qualifier from the refname
> member to signify that ownership of the string is handed to the struct,
> leaving cleanup duty with the caller of parse_treeish_arg(), thus
> avoiding a cast.

Yeah, I looked at the surrounding code and agree that this is the right
thing to do.

I wondered if it might make  sense for the initialization and clearing
of this "archive_args" structure to go in a pair of matched functions,
but it probably isn't worth the trouble. write_archive() is the only
place where we will allocate and deallocate such a struct (the only
reason it is a type at all is to pass the set of values around the
stack).

-Peff



[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