]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
lwp: Avoid freeing 'stackmemory' on AIX32
authorAndrew Deason <adeason@sinenomine.net>
Mon, 14 Jan 2019 23:12:27 +0000 (17:12 -0600)
committerStephan Wiesand <stephan.wiesand@desy.de>
Fri, 25 Jan 2019 14:38:26 +0000 (09:38 -0500)
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 <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit f6182922455aa0cbee19d138b0827eb87dc2b7ce)

Change-Id: Id32eea373799c0cb43fb01a98210a0800899a1d6
Reviewed-on: https://gerrit.openafs.org/13427
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
src/lwp/lwp.c

index 3ff9afc4bcdabb6562998b876950479b0bbb2cb7..496e773e00eb40a15e717d60454053385c3fe4d9 100644 (file)
@@ -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;
        }