From 500a0f93e879244c878c92c83aabf92d871f600a Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sun, 12 Nov 2023 20:08:55 -0600 Subject: [PATCH] Don't try to free old optargs in toy_init(). The shell frees it after running a NOFORK and the minor memory leak in a "nice nohup setsid taskset xargs nsenter chroot" stack isn't enough return to try to make sure it always points to something sufficiently known: you can't free(++toys.optargs). --- main.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/main.c b/main.c index 6fc27099..c6f5a873 100644 --- a/main.c +++ b/main.c @@ -195,9 +195,6 @@ void toy_init(struct toy_list *which, char *argv[]) } } - // Free old toys contents (to be reentrant), but leave rebound if any - // don't blank old optargs if our new argc lives in the old optargs. - if (argvtoys.optargs+toys.optc) free(toys.optargs); memset(&toys, 0, offsetof(struct toy_context, rebound)); if (oldwhich) memset(&this, 0, sizeof(this)); -- 2.39.2