Re: [PATCH 6/7] init-db: silence template_dir leak when converting to absolute path

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

 



On Mon, Mar 08, 2021 at 06:36:19PM +0000, Andrzej Hunt via GitGitGadget wrote:

> template_dir starts off pointing to either argv or nothing. However if
> the value supplied in argv is a relative path, absolute_pathdup() is
> used to turn it into an absolute path. absolute_pathdup() allocates
> a new string, and we then "leak" it when cmd_init_db() completes.
> 
> We don't bother to actually free the return value (instead we UNLEAK
> it), because there's no significant advantage to doing so here.
> Correctly freeing it would require more significant changes to code flow
> which would be more noisy than beneficial.

Makes sense. The UNLEAK() could be conditional at the end of the
function (since it is OK to unleak a non-allocated variable, too), but I
like keeping it here with the allocation for clarity.

-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