diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c index 230d147be3f32e2dd46cbb1ee4993453cc14af3f..263dbff18b1e7495960fe2bc4f25b502eadd0b0f 100644 --- a/res/res_rtp_asterisk.c +++ b/res/res_rtp_asterisk.c @@ -3247,7 +3247,9 @@ static int ast_rtp_destroy(struct ast_rtp_instance *instance) * entry at this point since it holds a reference to the * RTP instance while it's active. */ - close(rtp->rtcp->s); + if (rtp->rtcp->s > -1 && rtp->s != rtp->rtcp->s) { + close(rtp->rtcp->s); + } ast_free(rtp->rtcp->local_addr_str); ast_free(rtp->rtcp); }