From: Andrey Hristov Date: Thu, 11 Jun 2009 08:51:20 +0000 (+0000) Subject: Protect the code when variable is NULL, which should never happen, but X-Git-Tag: php-5.4.0alpha1~191^2~3359 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=433286f150fb5a2eff013416d1e0817db7539511;p=php Protect the code when variable is NULL, which should never happen, but anyway, you know about "never happens" --- diff --git a/ext/mysqlnd/mysqlnd_block_alloc.c b/ext/mysqlnd/mysqlnd_block_alloc.c index 2dcedcbfe6..4943624f47 100644 --- a/ext/mysqlnd/mysqlnd_block_alloc.c +++ b/ext/mysqlnd/mysqlnd_block_alloc.c @@ -183,10 +183,12 @@ void mysqlnd_mempool_destroy(MYSQLND_MEMORY_POOL * pool TSRMLS_DC) { DBG_ENTER("mysqlnd_mempool_destroy"); - /* mnd_free will reference LOCK_access and might crash, depending on the caller...*/ - mysqlnd_mempool_free_contents(pool TSRMLS_CC); - mnd_free(pool->arena); - mnd_free(pool); + if (pool) { + /* mnd_free will reference LOCK_access and might crash, depending on the caller...*/ + mysqlnd_mempool_free_contents(pool TSRMLS_CC); + mnd_free(pool->arena); + mnd_free(pool); + } DBG_VOID_RETURN; } /* }}} */