From: Tobias Stoeckmann Date: Sat, 11 Apr 2026 18:38:02 +0000 (+0200) Subject: lib/cpuset: Skip optarg duplication X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=e41758c6194fcb92cc6e9d136984bc6c4ceb59b7;p=thirdparty%2Futil-linux.git lib/cpuset: Skip optarg duplication Fix potential memory leaks and clarify that content of these strings is never modified. Won't happen since this is test code, but adjust it for completeness. Signed-off-by: Tobias Stoeckmann --- diff --git a/lib/cpuset.c b/lib/cpuset.c index b04c71a35..c5679888e 100644 --- a/lib/cpuset.c +++ b/lib/cpuset.c @@ -395,10 +395,10 @@ int main(int argc, char *argv[]) ncpus = atoi(optarg); break; case 'm': - mask = strdup(optarg); + mask = optarg; break; case 'r': - range = strdup(optarg); + range = optarg; break; default: goto usage_err; @@ -435,8 +435,6 @@ int main(int argc, char *argv[]) printf("[%s]\n", cpulist_create(buf, buflen, set, setsize)); free(buf); - free(mask); - free(range); cpuset_free(set); return EXIT_SUCCESS;