From 189e3b9e7eaf0d3c69526b9a76877bb39e79e030 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 5 May 2015 11:01:22 +0200 Subject: [PATCH] iscsi-scstd: Fix a dereference-before-null-check Detected by Coverity. Signed-off-by: Bart Van Assche --- iscsi-scst/usr/session.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iscsi-scst/usr/session.c b/iscsi-scst/usr/session.c index fe25b1c05..9886cfe42 100644 --- a/iscsi-scst/usr/session.c +++ b/iscsi-scst/usr/session.c @@ -172,11 +172,11 @@ void session_free(struct session *session) { log_debug(1, "Freeing session sid %#"PRIx64, session->sid.id64); - kernel_session_destroy(session->target->tid, session->sid.id64); - if (session->target) { struct target *target = session->target; + kernel_session_destroy(target->tid, session->sid.id64); + target->sessions_count--; log_debug(1, "target %s, sessions_count %d", target->name, target->sessions_count);