Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mismatch alloc free #431

Merged
merged 2 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/iser.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion lib/pdu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Loading