summaryrefslogtreecommitdiff
path: root/ext/mysqlnd/mysqlnd_statistics.c
diff options
context:
space:
mode:
authorPierre Joye <pajoye@php.net>2011-01-17 14:07:40 +0000
committerPierre Joye <pajoye@php.net>2011-01-17 14:07:40 +0000
commite3785f253e9c2935e894019a3a07b7f443b7aaf0 (patch)
tree291d6a33121287160c7a28759b0366d89cd6112e /ext/mysqlnd/mysqlnd_statistics.c
parent5c23366d6b788d69fdc67f8546f655c8c9bbbe48 (diff)
downloadphp-git-e3785f253e9c2935e894019a3a07b7f443b7aaf0.tar.gz
- 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)
Diffstat (limited to 'ext/mysqlnd/mysqlnd_statistics.c')
-rw-r--r--ext/mysqlnd/mysqlnd_statistics.c4
1 files changed, 4 insertions, 0 deletions
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;