From: Pierre Joye Date: Mon, 17 Jan 2011 14:07:40 +0000 (+0000) Subject: - don't try to access if calloc fails (quick review of its usage: seems that the... X-Git-Tag: php-5.3.6RC1~110 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e3785f253e9c2935e894019a3a07b7f443b7aaf0;p=php - don't try to access if calloc fails (quick review of its usage: seems that the stats member is validated in other places, to be confirmed) --- diff --git a/ext/mysqlnd/mysqlnd_statistics.c b/ext/mysqlnd/mysqlnd_statistics.c index a203fdac07..174ca682d7 100644 --- a/ext/mysqlnd/mysqlnd_statistics.c +++ b/ext/mysqlnd/mysqlnd_statistics.c @@ -247,6 +247,10 @@ PHPAPI void mysqlnd_stats_init(MYSQLND_STATS ** stats, size_t statistic_count) { *stats = calloc(1, sizeof(MYSQLND_STATS)); + if (*stats == NULL) { + DBG_ENTER("mysqlnd_stats_init failed to calloc stats context"); + return; + } (*stats)->values = calloc(statistic_count, sizeof(uint64_t)); (*stats)->triggers = calloc(statistic_count, sizeof(mysqlnd_stat_trigger)); (*stats)->in_trigger = FALSE;