From e3785f253e9c2935e894019a3a07b7f443b7aaf0 Mon Sep 17 00:00:00 2001 From: Pierre Joye Date: Mon, 17 Jan 2011 14:07:40 +0000 Subject: [PATCH] - 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) --- ext/mysqlnd/mysqlnd_statistics.c | 4 ++++ 1 file changed, 4 insertions(+) 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; -- 2.50.1