From 49d68945c01cdb29490de3ebbee42036ca23ef87 Mon Sep 17 00:00:00 2001 From: Manikandan Selvaganesh Date: Mon, 16 Feb 2015 14:26:54 +0530 Subject: io-stats : null dereference coverity fix. CID :1124502 Change-Id: I2911be340e8e48a52e951d0f04f6a96f3c219fab BUG: 789278 Signed-off-by: Manikandan Selvaganesh Reviewed-on: http://review.gluster.org/9659 Tested-by: Gluster Build System Reviewed-by: Humble Devassy Chirammal Reviewed-by: Kaleb KEITHLEY Reviewed-by: Vijay Bellur --- xlators/debug/io-stats/src/io-stats.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (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 e6e57c37451..6fba80c5e43 100644 --- a/xlators/debug/io-stats/src/io-stats.c +++ b/xlators/debug/io-stats/src/io-stats.c @@ -481,11 +481,13 @@ ios_stat_add_to_list (struct ios_stat_head *list_head, uint64_t value, new->value = value; ios_stat_ref (iosstat); list_add_tail (&new->list, &tmp->list); - stat = last->iosstat; - last->iosstat = NULL; - ios_stat_unref (stat); - list_del (&last->list); - GF_FREE (last); + if (last) { + stat = last->iosstat; + last->iosstat = NULL; + ios_stat_unref (stat); + list_del (&last->list); + GF_FREE (last); + } if (reposition == MAX_LIST_MEMBERS) list_head->min_cnt = value; else if (min_count) { -- cgit