Merge pull request #431 from Ir1Ka/fix-mismatch-alloc-free

Fix mismatch alloc free
This commit is contained in:
Ronnie Sahlberg
2024-11-11 00:16:59 -05:00
committed by GitHub
2 changed files with 6 additions and 2 deletions

View File

@@ -770,7 +770,11 @@ iser_prepare_read_cmd(struct iser_conn *iser_conn,struct iser_pdu *iser_pdu)
if (data_size > 0) {
if (task->iovector_in.iov == NULL) {
iser_pdu->iscsi_pdu.indata.data = iscsi_malloc(iscsi, data_size);
if (data_size <= iscsi->smalloc_size) {
iser_pdu->iscsi_pdu.indata.data = iscsi_smalloc(iscsi, data_size);
} else {
iser_pdu->iscsi_pdu.indata.data = iscsi_malloc(iscsi, data_size);
}
if (iser_pdu->iscsi_pdu.indata.data == NULL) {
iscsi_set_error(iscsi, "Failed to aloocate data buffer");
return -1;

View File

@@ -205,7 +205,7 @@ iscsi_allocate_pdu(struct iscsi_context *iscsi, enum iscsi_opcode opcode,
if (pdu->outdata.data == NULL) {
iscsi_set_error(iscsi, "failed to allocate pdu header");
iscsi_free(iscsi, pdu);
iscsi->drv->free_pdu(iscsi, pdu);
return NULL;
}