lib: Make scsi_free_scsi_task() accept a NULL task pointer

Several cleanup paths can be simplified if it is allowed to pass a
NULL pointer to scsi_free_scsi_task(). Hence modify this function
such that it returns immediately if passed a NULL task pointer.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
This commit is contained in:
Bart Van Assche
2013-10-21 12:35:48 +02:00
committed by Ronnie Sahlberg
parent f6a52d11c0
commit afa076b537

View File

@@ -66,6 +66,9 @@ scsi_free_scsi_task(struct scsi_task *task)
{
struct scsi_allocated_memory *mem;
if (!task)
return;
while ((mem = task->mem)) {
SLIST_REMOVE(&task->mem, mem);
free(mem);