Skip to contentSkip to conversation

mkfs: Fix memory leark

PATCH In review Pavel Reichl 2 participants 3 messages May 24, 2022 – May 25, 2022

lore
Share & tools
lore
#0 lore raw

v2 cover mkfs: Fix memory leark

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(+)
Signature · 1 line
2.36.1
#1 lore raw

PATCH v2 1/1 mkfs: Fix memory leak

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

---
 mkfs/xfs_mkfs.c | 1 +
 1 file changed, 1 insertion(+)
mkfs/xfs_mkfs.c +1 -0
index 01d2e8ca..a37d6848 100644
@@ -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);
Signature · 1 line
2.36.1