From: Andrew Deason Date: Mon, 14 Jan 2019 23:12:27 +0000 (-0600) Subject: lwp: Avoid freeing 'stackmemory' on AIX32 X-Git-Tag: upstream/1.8.3^2~11 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=97f830605d5f251c58382c3f9febc4d98e949ee8;p=packages%2Fo%2Fopenafs.git lwp: Avoid freeing 'stackmemory' on AIX32 Commit 55013a11 (lwp: Fix possible memory leak from scan-build) added some free() calls to some otherwise-leaked memory. However, one of these calls frees the 'stackmemory' pointer, which on AIX32 is not a pointer from malloc/calloc, but calculated from reserveFromStack(). To avoid corrupting the heap, skip this free call on AIX32. This commit adds another #ifdef to avoid this, which is unfortunate, but this is also how the free is avoided in the existing code for Free_PCB(). Reviewed-on: https://gerrit.openafs.org/13426 Tested-by: BuildBot Reviewed-by: Michael Meffie Reviewed-by: Benjamin Kaduk (cherry picked from commit f6182922455aa0cbee19d138b0827eb87dc2b7ce) Change-Id: Id32eea373799c0cb43fb01a98210a0800899a1d6 Reviewed-on: https://gerrit.openafs.org/13427 Tested-by: BuildBot Reviewed-by: Michael Meffie Reviewed-by: Stephan Wiesand --- diff --git a/src/lwp/lwp.c b/src/lwp/lwp.c index 3ff9afc4b..496e773e0 100644 --- a/src/lwp/lwp.c +++ b/src/lwp/lwp.c @@ -355,7 +355,9 @@ LWP_CreateProcess(void *(*ep) (void *), int stacksize, int priority, void *parm, #endif if (priority < 0 || priority >= MAX_PRIORITIES) { free(temp); +#ifndef AFS_AIX32_ENV free(stackmemory); +#endif Set_LWP_RC(); return LWP_EBADPRI; }