[PATCH] jobs: Fix here-document crash
Herbert Xu <[email protected]> Tue, 3 Feb 2026 13:36:03 +0800
| Newsgroups | org.kernel.vger.dash |
|---|---|
| Message-ID | <[email protected]> |
When forkchild is called while expanding here-documents, the job pointer is set to NULL. If this is the case, there is no need to free the job pointer and other outstanding jobs. Simply return if this is the case. Reported-by: Hadrien LACOUR <[email protected]> Fixes: 9881d00e939e ("jobs: Preserve parent jobs for simple commands") Signed-off-by: Herbert Xu <[email protected]> diff --git a/src/jobs.c b/src/jobs.c index 6622bdd..36c6261 100644 --- a/src/jobs.c +++ b/src/jobs.c @@ -919,6 +919,9 @@ static void forkchild(struct job *jp, union node *n, int mode) if (lvforked) return; + if (!jp) + return; + freejob(jp); if (issimplecmd(n, JOBSCMD->name)) -- Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt