From f6182922455aa0cbee19d138b0827eb87dc2b7ce Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Mon, 14 Jan 2019 17:12:27 -0600 Subject: [PATCH] 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(). Change-Id: I6c4518f810e56c362ee744f250747fe8fc765b13 Reviewed-on: https://gerrit.openafs.org/13426 Tested-by: BuildBot Reviewed-by: Michael Meffie Reviewed-by: Benjamin Kaduk --- src/lwp/lwp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lwp/lwp.c b/src/lwp/lwp.c index de9d651..7599475 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; } -- 1.9.4