Blame SOURCES/0022-lib-Make-scsi_free_scsi_task-accept-a-NULL-task-pointer.patch

dc245c
lib: Make scsi_free_scsi_task() accept a NULL task pointer
dc245c
dc245c
Message-id: <1383729402-27559-4-git-send-email-pbonzini@redhat.com>
dc245c
Patchwork-id: 55498
dc245c
O-Subject: [PATCH 03/11] lib: Make scsi_free_scsi_task() accept a NULL task pointer
dc245c
Bugzilla: 1026820
dc245c
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
dc245c
RH-Acked-by: Orit Wasserman <owasserm@redhat.com>
dc245c
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
dc245c
dc245c
From: Bart Van Assche <bvanassche@acm.org>
dc245c
dc245c
Several cleanup paths can be simplified if it is allowed to pass a
dc245c
NULL pointer to scsi_free_scsi_task(). Hence modify this function
dc245c
such that it returns immediately if passed a NULL task pointer.
dc245c
dc245c
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
dc245c
(cherry picked from commit afa076b5377cff7e1b4096965849e7939c399af1)
dc245c
---
dc245c
 lib/scsi-lowlevel.c | 3 +++
dc245c
 1 file changed, 3 insertions(+)
dc245c
diff --git a/lib/scsi-lowlevel.c b/lib/scsi-lowlevel.c
dc245c
index ce9f904..0f97a79 100644
dc245c
--- a/lib/scsi-lowlevel.c
dc245c
+++ b/lib/scsi-lowlevel.c
dc245c
@@ -50,6 +50,9 @@ scsi_free_scsi_task(struct scsi_task *task)
dc245c
 {
dc245c
 	struct scsi_allocated_memory *mem;
dc245c
 
dc245c
+	if (!task)
dc245c
+		return;
dc245c
+
dc245c
 	while ((mem = task->mem)) {
dc245c
 		   SLIST_REMOVE(&task->mem, mem);
dc245c
 		   free(mem);