diff options
author | наб <[email protected]> | 2022-03-08 22:50:45 +0100 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2022-04-01 17:55:24 -0700 |
commit | a3dcc0aa0c0b7873265d0b014ea6133bd8e40591 (patch) | |
tree | b8b9c716de42c23fa0554362ad76dfadf1677f0a | |
parent | 84a3eab6aa44dedaec6d3f5e6da9ccb4b9942907 (diff) |
zfs, zpool: safe_malloc() duplicate argv
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: John Kennedy <[email protected]>
Reviewed-by: Ryan Moeller <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes #13259
-rw-r--r-- | cmd/zfs/zfs_main.c | 2 | ||||
-rw-r--r-- | cmd/zpool/zpool_main.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c index 097b270b2..2a771c6d6 100644 --- a/cmd/zfs/zfs_main.c +++ b/cmd/zfs/zfs_main.c @@ -8697,7 +8697,7 @@ main(int argc, char **argv) * Many commands modify input strings for string parsing reasons. * We create a copy to protect the original argv. */ - newargv = malloc((argc + 1) * sizeof (newargv[0])); + newargv = safe_malloc((argc + 1) * sizeof (newargv[0])); for (i = 0; i < argc; i++) newargv[i] = strdup(argv[i]); newargv[argc] = NULL; diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c index 5d1cae3e9..043b6a226 100644 --- a/cmd/zpool/zpool_main.c +++ b/cmd/zpool/zpool_main.c @@ -10924,7 +10924,7 @@ main(int argc, char **argv) * Many commands modify input strings for string parsing reasons. * We create a copy to protect the original argv. */ - newargv = malloc((argc + 1) * sizeof (newargv[0])); + newargv = safe_malloc((argc + 1) * sizeof (newargv[0])); for (i = 0; i < argc; i++) newargv[i] = strdup(argv[i]); newargv[argc] = NULL; |