Browse Source

Reclaim _REENT_MP_P5S in _reclaim_reent

The _REENT_MP_P5S blocks are allocated using Balloc via i2b and linked in the
pow5mult call. As a result these blocks are not on the freelist managed by the
Bfree call. This change fixes a memory leak in threads that clean up using
_reclaim_reent.

RTEMS: Closes #4967
users/vapier/wip
Chris Johns 3 years ago
committed by Corinna Vinschen
parent
commit
37e67d1595
  1. 11
      newlib/libc/reent/reent.c

11
newlib/libc/reent/reent.c

@ -59,6 +59,17 @@ _reclaim_reent (struct _reent *ptr)
}
if (_REENT_MP_RESULT(ptr))
_free_r (ptr, _REENT_MP_RESULT(ptr));
if (_REENT_MP_P5S(ptr))
{
struct _Bigint *thisone, *nextone;
nextone = _REENT_MP_P5S(ptr);
while (nextone)
{
thisone = nextone;
nextone = nextone->_next;
_free_r (ptr, thisone);
}
}
#ifdef _REENT_SMALL
}
#endif

Loading…
Cancel
Save