Re: [PATCH] mkfs: Fix memory leak

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

 



On Tue, May 24, 2022 at 10:40:40PM +0200, Pavel Reichl wrote:
> 'value' is allocated by strup() in getstr(). It

Nit: strdup, not strup.

> needs to be freed as we do not keep any permanent
> reference to it.
> 
> Signed-off-by: Pavel Reichl <preichl@xxxxxxxxxx>

With that fixed,
Reviewed-by: Darrick J. Wong <djwong@xxxxxxxxxx>

--D

> ---
>  mkfs/xfs_mkfs.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
> index 01d2e8ca..a37d6848 100644
> --- a/mkfs/xfs_mkfs.c
> +++ b/mkfs/xfs_mkfs.c
> @@ -1714,6 +1714,7 @@ naming_opts_parser(
>  		} else {
>  			cli->sb_feat.dir_version = getnum(value, opts, subopt);
>  		}
> +		free((char *)value);
>  		break;
>  	case N_FTYPE:
>  		cli->sb_feat.dirftype = getnum(value, opts, subopt);
> -- 
> 2.36.1
> 



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux