Skip to content

Commit

Permalink
don't try to memcpy if src and dest are the same
Browse files Browse the repository at this point in the history
  • Loading branch information
jpbland1 committed Apr 9, 2024
1 parent 302a7cf commit 072ac77
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/wh_comm.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ int wh_CommClient_SendRequest(whCommClient* context,
context->hdr->magic = magic;
context->hdr->kind = wh_Translate16(magic, kind);
context->hdr->seq = wh_Translate16(magic, context->seq + 1);
if ((data != NULL) && (data_size != 0)) {
/* don't try to memcpy if src and dest are the same */
if ((data != NULL) && (data_size != 0) && data != context->data) {
memcpy(context->data, data, data_size);
}
rc = context->transport_cb->Send(context->transport_context,
Expand Down

0 comments on commit 072ac77

Please sign in to comment.