]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/sl_malloc.c
ITS#8655 fix double free on paged search with pagesize 0
[openldap] / servers / slapd / sl_malloc.c
index fbc34ff659623a180cd63b63a5d0a591144682cc..ff56c4f249c2258308bfb98bee799989cfbdb718 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2003-2013 The OpenLDAP Foundation.
+ * Copyright 2003-2017 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -279,16 +279,17 @@ slap_sl_mem_create(
 }
 
 /*
- * Separate memory context from thread context.  Future users must
+ * Assign memory context to thread context. Use NULL to detach
+ * current memory context from thread. Future users must
  * know the context, since ch_free/slap_sl_context() cannot find it.
  */
 void
-slap_sl_mem_detach(
+slap_sl_mem_setctx(
        void *thrctx,
        void *memctx
 )
 {
-       SET_MEMCTX(thrctx, NULL, 0);
+       SET_MEMCTX(thrctx, memctx, slap_sl_mem_destroy);
 }
 
 void *