diff --git a/src/rtpp_command_async.c b/src/rtpp_command_async.c index 723c74ba6..6f1a97243 100644 --- a/src/rtpp_command_async.c +++ b/src/rtpp_command_async.c @@ -435,10 +435,11 @@ rtpp_cmd_queue_run(void *arg) rtpp_cmd_connection_dtor(psp->rccs[i]); psp->pfds_used--; if (psp->pfds_used > 0 && i < psp->pfds_used) { - memcpy(&psp->pfds[i], &psp->pfds[i + 1], + memmove(&psp->pfds[i], &psp->pfds[i + 1], (psp->pfds_used - i) * sizeof(struct pollfd)); - memcpy(&psp->rccs[i], &psp->rccs[i + 1], + memmove(&psp->rccs[i], &psp->rccs[i + 1], (psp->pfds_used - i) * sizeof(struct rtpp_ctrl_connection *)); + i--; } } }