From 4c0e4741f75ca503f25493ab44be7133a2389b95 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Fri, 23 May 2003 09:10:05 +0000 Subject: [PATCH] Add comments to sl_mem_detach() --- servers/slapd/sl_malloc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/servers/slapd/sl_malloc.c b/servers/slapd/sl_malloc.c index 23b0a1fb54..e635cafc62 100644 --- a/servers/slapd/sl_malloc.c +++ b/servers/slapd/sl_malloc.c @@ -78,7 +78,15 @@ sl_mem_detach( void *memctx ) { + /* separate from context */ ldap_pvt_thread_pool_setkey( ctx, sl_mem_init, NULL, NULL ); + + /* The code used to try to use realloc to shrink the region. + * This is unsafe, since realloc may return a different block + * of memory from what was passed in, and the region contains + * pointers that reference itself. After realloc, these pointers + * are invalid, and crashes result. + */ } void * -- 2.39.5