pajoye Mon, 17 Jan 2011 14:07:40 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=307538
Log: - 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) Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.c U php/php-src/trunk/ext/mysqlnd/mysqlnd_statistics.c Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.c =================================================================== --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.c 2011-01-17 14:01:01 UTC (rev 307537) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.c 2011-01-17 14:07:40 UTC (rev 307538) @@ -247,6 +247,10 @@ 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; Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_statistics.c =================================================================== --- php/php-src/trunk/ext/mysqlnd/mysqlnd_statistics.c 2011-01-17 14:01:01 UTC (rev 307537) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd_statistics.c 2011-01-17 14:07:40 UTC (rev 307538) @@ -245,6 +245,10 @@ 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;
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php