libc - Fix a serious memory leak in the nmalloc code
commit064bf225823454be0c9f72ddfca7f7c6cc209cd5
authorMatthew Dillon <dillon@apollo.backplane.com>
Thu, 30 Apr 2020 08:39:05 +0000 (30 01:39 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Thu, 30 Apr 2020 08:39:05 +0000 (30 01:39 -0700)
tree070ef397061100f21c1fc798fa79dc44466fe22d
parent965c458c932cc375c59ca2e7eae94f724dd90182
libc - Fix a serious memory leak in the nmalloc code

* Fix a bug where mtmagazine_free() would assign mt->newmag without
  re-checking its contents, potentially overwriting an assignment
  made by _slaballoc(), causing a memory leak.

* This bug generally rears its ugly head in heavily pthreaded programs,
  but it can occur under other conditions too.

Reported-by: hsw (irc)
lib/libc/stdlib/nmalloc.c