From 665591074fbef562b48a9cd1b74b3d4cc92cd667 Mon Sep 17 00:00:00 2001 From: Raghavendra Bhat Date: Tue, 25 May 2010 09:00:38 +0000 Subject: Check whether NULL is returned after GF_CALLOC in the init function of io-stats Signed-off-by: Raghavendra Bhat Signed-off-by: Anand V. Avati BUG: 946 (Null check in init function of io-stats) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=946 --- xlators/debug/io-stats/src/io-stats.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'xlators/debug') diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c index f5787a710..ee9c29e69 100644 --- a/xlators/debug/io-stats/src/io-stats.c +++ b/xlators/debug/io-stats/src/io-stats.c @@ -1435,6 +1435,12 @@ init (xlator_t *this) conf = GF_CALLOC (1, sizeof(*conf), gf_io_stats_mt_ios_conf); + if (!conf) { + gf_log (this->name, GF_LOG_ERROR, + "Out of memory."); + return -1; + } + LOCK_INIT (&conf->lock); gettimeofday (&conf->cumulative.started_at, NULL); -- cgit