[Asterisk-code-review] Revert "Revert "res_rtp_asterisk: Free payload when error on insertio... (asterisk[certified/16.8])
Friendly Automation
asteriskteam at digium.com
Thu Apr 30 10:03:10 CDT 2020
Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/14372 )
Change subject: Revert "Revert "res_rtp_asterisk: Free payload when error on insertion to data buffer""
......................................................................
Revert "Revert "res_rtp_asterisk: Free payload when error on insertion to data buffer""
This reverts commit fe3dc091b57bf16ba62e185fe05f77069062a3b1.
Reason for revert: This will be merged once 16.8-cert1 is released.
Change-Id: I5c29f96a70ed7e1fa146a69e7b48bfe31cbee929
---
M main/data_buffer.c
M res/res_rtp_asterisk.c
2 files changed, 7 insertions(+), 3 deletions(-)
Approvals:
George Joseph: Looks good to me, approved
Friendly Automation: Approved for Submit
diff --git a/main/data_buffer.c b/main/data_buffer.c
index cfc323c..85e7971 100644
--- a/main/data_buffer.c
+++ b/main/data_buffer.c
@@ -254,7 +254,7 @@
AST_LIST_TRAVERSE_SAFE_END;
if (inserted == -1) {
- return 0;
+ return -1;
}
if (!inserted) {
diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index e3f4e54..134eebc 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -4897,7 +4897,9 @@
if (payload) {
payload->size = packet_len;
memcpy(payload->buf, rtpheader, packet_len);
- ast_data_buffer_put(rtp->send_buffer, rtp->seqno, payload);
+ if (ast_data_buffer_put(rtp->send_buffer, rtp->seqno, payload) == -1) {
+ ast_free(payload);
+ }
}
}
@@ -7847,7 +7849,9 @@
payload->size = res;
memcpy(payload->buf, rtpheader, res);
- ast_data_buffer_put(rtp->recv_buffer, seqno, payload);
+ if (ast_data_buffer_put(rtp->recv_buffer, seqno, payload) == -1) {
+ ast_free(payload);
+ }
/* If this sequence number is removed that means we had a gap and this packet has filled it in
* some. Since it was part of the gap we will have already added any other missing sequence numbers
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/14372
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: certified/16.8
Gerrit-Change-Id: I5c29f96a70ed7e1fa146a69e7b48bfe31cbee929
Gerrit-Change-Number: 14372
Gerrit-PatchSet: 2
Gerrit-Owner: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200430/bbf58e75/attachment-0001.html>
More information about the asterisk-code-review
mailing list