X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fsl_malloc.c;h=32b61f40e4937fdfd9f56dcab7a4bbbe8ac3d87e;hb=04cfd144d9f31b6e1f3d9d85b6fdd932ef18a153;hp=85def9a82aff34bdb0d41d5bd93596b9773a5f31;hpb=7a30ce8c08eb43e30305bb69a3e4207fbf82cf71;p=openldap diff --git a/servers/slapd/sl_malloc.c b/servers/slapd/sl_malloc.c index 85def9a82a..32b61f40e4 100644 --- a/servers/slapd/sl_malloc.c +++ b/servers/slapd/sl_malloc.c @@ -2,7 +2,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * - * Copyright 2003-2016 The OpenLDAP Foundation. + * Copyright 2003-2017 The OpenLDAP Foundation. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -137,6 +137,9 @@ slap_sl_mem_destroy( struct slab_object *so; int i; + if (!sh) + return; + if (!sh->sh_stack) { for (i = 0; i <= sh->sh_maxorder - order_start; i++) { so = LDAP_LIST_FIRST(&sh->sh_free[i]); @@ -649,6 +652,21 @@ slap_sl_free(void *ptr, void *ctx) } } +void +slap_sl_release( void *ptr, void *ctx ) +{ + struct slab_heap *sh = ctx; + if ( sh && ptr >= sh->sh_base && ptr <= sh->sh_end ) + sh->sh_last = ptr; +} + +void * +slap_sl_mark( void *ctx ) +{ + struct slab_heap *sh = ctx; + return sh->sh_last; +} + /* * Return the memory context of the current thread if the given block of * memory belongs to it, otherwise return NULL.