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:
committed by
Ronnie Sahlberg
parent
f6a52d11c0
commit
afa076b537
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user