]> granicus.if.org Git - php/commitdiff
- don't try to access if calloc fails (quick review of its usage: seems that the...
authorPierre Joye <pajoye@php.net>
Mon, 17 Jan 2011 14:07:40 +0000 (14:07 +0000)
committerPierre Joye <pajoye@php.net>
Mon, 17 Jan 2011 14:07:40 +0000 (14:07 +0000)
ext/mysqlnd/mysqlnd_statistics.c

index a203fdac070f03cf3a4e579370b56ea7f0c4fed7..174ca682d745f6e850fff277f76b8e64fc48bb27 100644 (file)
@@ -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;