[OpenSIPS-Devel] [OpenSIPS/opensips] 2254d0: F_MALLOC: Recover from double pointer free

Liviu Chircu liviu at opensips.org
Thu Feb 15 10:59:34 EST 2018


  Branch: refs/heads/master
  Home:   https://github.com/OpenSIPS/opensips
  Commit: 2254d0011535d37d8aa05387d4d967d074d7b9d5
      https://github.com/OpenSIPS/opensips/commit/2254d0011535d37d8aa05387d4d967d074d7b9d5
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2018-02-15 (Thu, 15 Feb 2018)

  Changed paths:
    M mem/f_malloc.c
    M mem/f_malloc.h

  Log Message:
  -----------
  F_MALLOC: Recover from double pointer free

This patch makes F_MALLOC more robust in production by avoiding memory
corruption in case of double free operations. Previously, the hash state
would immediately get corrupted on such operations, and it would only be
a matter of time before the allocator would crash in some random place
with a useless backtrace resembling:

\#0  0x0000000000507209 in fm_remove_free (qm=0x7f7d578d2010, size=56) at
mem/f_malloc.c:200
200          *pf=n->u.nxt_free;

When DBG_MALLOC is defined, F_MALLOC will now abort() on a double free,
similar to QM_MALLOC.




More information about the Devel mailing list