From: chrisj@rtems.org
To: newlib@sourceware.org
Cc: Chris Johns <chrisj@rtems.org>
Subject: [PATCH] Reclaim _REENT_MP_P5S in _reclaim_reent
Date: Thu, 16 Nov 2023 12:12:15 +1100 [thread overview]
Message-ID: <20231116011215.21144-1-chrisj@rtems.org> (raw)
From: Chris Johns <chrisj@rtems.org>
The change fixes a memory leak in threads that clean up using
_reclaim_reent.
RTEMS: Closes #4967
---
newlib/libc/reent/reent.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/newlib/libc/reent/reent.c b/newlib/libc/reent/reent.c
index db80ca06e..6bb271b9a 100644
--- a/newlib/libc/reent/reent.c
+++ b/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
--
2.37.1
next reply other threads:[~2023-11-16 1:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-16 1:12 chrisj [this message]
2023-11-16 9:15 ` Corinna Vinschen
2023-11-16 21:17 ` Chris Johns
2023-11-17 12:08 ` Corinna Vinschen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231116011215.21144-1-chrisj@rtems.org \
--to=chrisj@rtems.org \
--cc=newlib@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).