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

prov/verbs_nd: Check error code from GetPrivateData #9574

Merged
merged 1 commit into from
Nov 16, 2023
Merged
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
10 changes: 8 additions & 2 deletions prov/verbs/src/windows/verbs_nd_ov.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ void nd_get_connection_data(IND2Connector *connector, struct nd_cm_event *event)
FI_LOG_EP_CTRL, "IND2Connector::GetPrivateData: hr=0x%08lx\n",
hr);

event->event.param.conn.private_data_len = (uint8_t)len;
if (len) {
if (SUCCEEDED(hr) && len) {
event->event.param.conn.private_data_len = (uint8_t)len;
event->event.param.conn.private_data = malloc(len);
if (event->event.param.conn.private_data) {
hr = connector->lpVtbl->GetPrivateData(
Expand All @@ -140,13 +140,19 @@ void nd_get_connection_data(IND2Connector *connector, struct nd_cm_event *event)
FI_LOG_EP_CTRL,
"IND2Connector::GetPrivateData: hr=0x%08lx\n",
hr);
if (FAILED(hr)) {
free(event->event.param.conn.private_data);
event->event.param.conn.private_data = NULL;
event->event.param.conn.private_data_len = 0;
}
} else {
event->event.param.conn.private_data_len = 0;
VRB_WARN(
FI_LOG_EP_CTRL,
"Failed to allocate memory for connection data.\n");
}
} else {
event->event.param.conn.private_data_len = 0;
event->event.param.conn.private_data = NULL;
}
}
Expand Down