git: 84d316496fa9 - stable/15 - rtld: extract donelist heap allocation into donelist_alloc()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 03 Nov 2026 09:01:57 UTC
The branch stable/15 has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=84d316496fa9f735304b10b2542b328a743b9f03
commit 84d316496fa9f735304b10b2542b328a743b9f03
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-10-25 17:57:39 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-11-03 09:01:11 +0000
rtld: extract donelist heap allocation into donelist_alloc()
(cherry picked from commit 53cbd14ea7ca78c140ee90c1e459589bb574d938)
---
libexec/rtld-elf/rtld.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index d2cd6c04a8a4..90ef765ab81c 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -1040,21 +1040,26 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp)
#define DLP_ALLOCA_LIMIT 100 /* 800 bytes on LP64 */
#define donelist_init(_DLP, _REQ) do { \
DoneList *_dlp = _DLP; \
- SymLook *_r = _REQ; \
_dlp->num_alloc = obj_count; \
_dlp->req = NULL; \
if (_dlp->num_alloc > DLP_ALLOCA_LIMIT) { \
- _dlp->objs = xcalloc(_dlp->num_alloc, sizeof(_dlp->objs[0])); \
- if (_r != NULL && _r->donelist_mem == NULL) { \
- _r->donelist_mem = _dlp->objs; \
- _dlp->req = _r; \
- } \
+ donelist_alloc(_dlp, _REQ); \
} else { \
_dlp->objs = alloca(_dlp->num_alloc * sizeof(_dlp->objs[0])); \
} \
_dlp->num_used = 0; \
} while (0)
+static void
+donelist_alloc(DoneList *dlp, SymLook *req)
+{
+ dlp->objs = xcalloc(dlp->num_alloc, sizeof(dlp->objs[0]));
+ if (req != NULL && req->donelist_mem == NULL) {
+ req->donelist_mem = dlp->objs;
+ dlp->req = req;
+ }
+}
+
static void
donelist_free(DoneList *dlp)
{