]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
liblib: pool_unref() should always set pool=NULL (alloconly pool)
authorBaofeng Wang <baofeng.wang@dovecot.fi>
Wed, 20 Apr 2016 14:24:06 +0000 (17:24 +0300)
committerGitLab <gitlab@git.dovecot.net>
Fri, 22 Apr 2016 19:56:09 +0000 (22:56 +0300)
set pool to NULL before return.

src/lib/mempool-alloconly.c

index bf3c94a8bfef77fe677fefc38fb886ef2de10210..3925438c6914cab90aa853bcff014bb4c5609d22 100644 (file)
@@ -198,13 +198,13 @@ static void pool_alloconly_unref(pool_t *pool)
 {
        struct alloconly_pool *apool = (struct alloconly_pool *)*pool;
 
-       if (--apool->refcount > 0)
-               return;
-
        /* erase the pointer before freeing anything, as the pointer may
           exist inside the pool's memory area */
        *pool = NULL;
 
+       if (--apool->refcount > 0)
+               return;
+
        pool_alloconly_destroy(apool);
 }