All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/1] mkfs: Fix memory leark
@ 2022-05-24 22:05 Pavel Reichl
  2022-05-24 22:05 ` [PATCH v2 1/1] mkfs: Fix memory leak Pavel Reichl
  0 siblings, 1 reply; 3+ messages in thread
From: Pavel Reichl @ 2022-05-24 22:05 UTC (permalink / raw)
  To: linux-xfs

V2:
- Fixed typo s/strup/strdup/
- Added Reviewed-by tag 

Pavel Reichl (1):
  mkfs: Fix memory leak

 mkfs/xfs_mkfs.c | 1 +
 1 file changed, 1 insertion(+)

-- 
2.36.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2 1/1] mkfs: Fix memory leak
  2022-05-24 22:05 [PATCH v2 0/1] mkfs: Fix memory leark Pavel Reichl
@ 2022-05-24 22:05 ` Pavel Reichl
  2022-05-25  7:24   ` Chaitanya Kulkarni
  0 siblings, 1 reply; 3+ messages in thread
From: Pavel Reichl @ 2022-05-24 22:05 UTC (permalink / raw)
  To: linux-xfs

'value' is allocated by strdup() in getstr(). It
needs to be freed as we do not keep any permanent
reference to it.

Signed-off-by: Pavel Reichl <preichl@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 1/1] mkfs: Fix memory leak
  2022-05-24 22:05 ` [PATCH v2 1/1] mkfs: Fix memory leak Pavel Reichl
@ 2022-05-25  7:24   ` Chaitanya Kulkarni
  0 siblings, 0 replies; 3+ messages in thread
From: Chaitanya Kulkarni @ 2022-05-25  7:24 UTC (permalink / raw)
  To: Pavel Reichl, linux-xfs

On 5/24/22 15:05, Pavel Reichl wrote:
> 'value' is allocated by strdup() in getstr(). It
> needs to be freed as we do not keep any permanent
> reference to it.
> 
> Signed-off-by: Pavel Reichl <preichl@redhat.com>
> Reviewed-by: Darrick J. Wong <djwong@kernel.org>
> ---

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-05-25  7:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-24 22:05 [PATCH v2 0/1] mkfs: Fix memory leark Pavel Reichl
2022-05-24 22:05 ` [PATCH v2 1/1] mkfs: Fix memory leak Pavel Reichl
2022-05-25  7:24   ` Chaitanya Kulkarni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.