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
commita1b2df31d6d7c2e724d2190e1ec0f5b728211529 (patch)
treee457ce13da4cabf6a6c5f8dea4f11c5e3404b7d3 /ext/mysqlnd/mysqlnd_statistics.c
parent59dc22153040849f0c3348985107146facca29c2 (diff)
downloadphp-git-a1b2df31d6d7c2e724d2190e1ec0f5b728211529.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 7745a244d5..3098a7cfa6 100644
--- a/ext/mysqlnd/mysqlnd_statistics.c
+++ b/ext/mysqlnd/mysqlnd_statistics.c
@@ -245,6 +245,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;