mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 04:11:08 +00:00
T.140: Fix format ref and memory leaks.
* channel.c:ast_sendtext(): Fix T.140 SendText memory leak. * format_compatibility.c: T.140 RED and T.140 were swapped. * res_rtp_asterisk.c:rtp_red_init(): Fix ast_format_t140_red ref leak. * res_rtp_asterisk.c:rtp_red_init(): Fix data race after starting periodic scheduled red_write(). * res_rtp_asterisk.c: Some other minor misc tweaks. Change-Id: Ifa27a2e0f8a966b1cf628607c86fc4374b0b88cb
This commit is contained in:
@@ -4887,16 +4887,18 @@ int ast_sendtext(struct ast_channel *chan, const char *text)
|
||||
if (ast_channel_tech(chan)->write_text && (ast_format_cap_has_type(ast_channel_nativeformats(chan), AST_MEDIA_TYPE_TEXT))) {
|
||||
struct ast_frame f;
|
||||
|
||||
memset(&f, 0, sizeof(f));
|
||||
f.frametype = AST_FRAME_TEXT;
|
||||
f.src = "DIALPLAN";
|
||||
f.mallocd = AST_MALLOCD_DATA;
|
||||
f.datalen = strlen(text);
|
||||
f.data.ptr = ast_strdup(text);
|
||||
f.offset = 0;
|
||||
f.seqno = 0;
|
||||
|
||||
f.subclass.format = ast_format_t140;
|
||||
res = ast_channel_tech(chan)->write_text(chan, &f);
|
||||
|
||||
if (f.data.ptr) {
|
||||
res = ast_channel_tech(chan)->write_text(chan, &f);
|
||||
ast_frfree(&f);
|
||||
}
|
||||
} else if (ast_channel_tech(chan)->send_text) {
|
||||
res = ast_channel_tech(chan)->send_text(chan, text);
|
||||
}
|
||||
|
Reference in New Issue
Block a user