-
-/* Return memory to the heap. */
-
-void mfree(void *md, void *ptr)
-{
- struct mdesc *mdp;
- register struct alignlist *l;
-
- if (ptr != NULL) {
- mdp = MD_TO_MDP(md);
- LOCK(mdp);
- for (l = mdp->aligned_blocks; l != NULL; l = l->next) {
- if (l->aligned == ptr) {
- l->aligned = NULL; /* Mark the slot in the list as free. */
- ptr = l->exact;
- break;
- }
- }
- if (mdp->mfree_hook != NULL) {
- (*mdp->mfree_hook) (mdp, ptr);
- } else {
- __mmalloc_free(mdp, ptr);
- }
- UNLOCK(mdp);
- }
-}