]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
chmem: Skip optarg duplication
authorTobias Stoeckmann <tobias@stoeckmann.org>
Sat, 11 Apr 2026 18:52:28 +0000 (20:52 +0200)
committerTobias Stoeckmann <tobias@stoeckmann.org>
Sun, 12 Apr 2026 11:08:38 +0000 (13:08 +0200)
The -z argument is only used for parsing without any modification of the
input string. Skip the duplication to fix memory leaks if -z is supplied
multiple times.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
sys-utils/chmem.c

index 5380e9704265f2a50b93f4f02e5afc041e204cb0..b7f3cb568169c3b0340f93bc84fca6ee2fbf12c1 100644 (file)
@@ -721,7 +721,7 @@ int main(int argc, char **argv)
                        desc->verbose = 1;
                        break;
                case 'z':
-                       zone = xstrdup(optarg);
+                       zone = optarg;
                        break;
                case 'c':
                        cmd = CMD_MEMORY_CONFIGURE;