summaryrefslogtreecommitdiffstats
path: root/xlators/debug/io-stats
diff options
context:
space:
mode:
authorManikandan Selvaganesh <mselvaga@redhat.com>2015-02-16 14:26:54 +0530
committerVijay Bellur <vbellur@redhat.com>2015-03-30 00:08:28 -0700
commit49d68945c01cdb29490de3ebbee42036ca23ef87 (patch)
tree9c1e4f347dd2470f2aed711402eed0ccdb16e323 /xlators/debug/io-stats
parentd680cbb47a2f630bbe062b48f910528e7ffad97d (diff)
io-stats : null dereference coverity fix.
CID :1124502 Change-Id: I2911be340e8e48a52e951d0f04f6a96f3c219fab BUG: 789278 Signed-off-by: Manikandan Selvaganesh <mselvaga@redhat.com> Reviewed-on: http://review.gluster.org/9659 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Humble Devassy Chirammal <humble.devassy@gmail.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/debug/io-stats')
-rw-r--r--xlators/debug/io-stats/src/io-stats.c12
1 files changed, 7 insertions, 5 deletions
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) {