From 753146c0ff4b1b55892b71b36d6ca97797867aaa Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Tue, 27 Jul 2010 11:13:32 +0000 Subject: some check added to the variables after GF_CALLOC handles some NULL dereference problems (reported by clang when ran with code where '#define GF_CALLOC NULL'). Signed-off-by: Amar Tumballi Signed-off-by: Anand V. Avati BUG: 966 (NULL check for avoiding NULL dereferencing of pointers..) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=966 --- xlators/performance/write-behind/src/write-behind.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'xlators/performance/write-behind/src') diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c index 4095527d828..d3f24a5909b 100644 --- a/xlators/performance/write-behind/src/write-behind.c +++ b/xlators/performance/write-behind/src/write-behind.c @@ -564,6 +564,7 @@ out: } GF_FREE (local); + local = NULL; } if (iobref != NULL) { @@ -579,10 +580,11 @@ out: * had we winded these requests, we would have unrefed * in wb_sync_cbk. */ - - list_for_each_entry_safe (request, dummy, &local->winds, - winds) { - wb_request_unref (request); + if (local) { + list_for_each_entry_safe (request, dummy, &local->winds, + winds) { + wb_request_unref (request); + } } if (file != NULL) { -- cgit