Skip to content

Commit

Permalink
F_MALLOC: Fix "last free" line reports when debugging
Browse files Browse the repository at this point in the history
If -DBG_MALLOC is in use, double free operations would report the
"first free" to actually be the malloc operation, which is incorrect.
  • Loading branch information
liviuchircu committed Mar 2, 2018
1 parent 9e92218 commit 234cf39
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions mem/f_malloc.c
Expand Up @@ -537,6 +537,12 @@ void fm_free(struct fm_block* qm, void* p)

no_join:

#ifdef DBG_MALLOC
f->file = file;
f->func = func;
f->line = line;
#endif

fm_insert_free(qm, f);
#if defined(DBG_MALLOC) || defined(STATISTICS)
qm->fragments -= 1;
Expand Down

0 comments on commit 234cf39

Please sign in to comment.