Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
block/iscsi: Document why we use raw malloc()
In block/iscsi.c we use a raw malloc() call, which is unusual
given the project standard is to use the glib memory allocation
functions. Document why we do so, to avoid it being converted
to g_malloc() by mistake.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-ID: <20230727150705.2664464-1-peter.maydell@linaro.org>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
  • Loading branch information
pm215 authored and Kevin Wolf committed Sep 1, 2023
1 parent b7bc1d0 commit 67b5d60
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions block/iscsi.c
Expand Up @@ -1058,6 +1058,7 @@ static BlockAIOCB *iscsi_aio_ioctl(BlockDriverState *bs,
return NULL;
}

/* Must use malloc(): this is freed via scsi_free_scsi_task() */
acb->task = malloc(sizeof(struct scsi_task));
if (acb->task == NULL) {
error_report("iSCSI: Failed to allocate task for scsi command. %s",
Expand Down

0 comments on commit 67b5d60

Please sign in to comment.