Merge "T.140: Fix format ref and memory leaks." into 13

This commit is contained in:
Joshua Colp
2017-01-26 11:30:45 -06:00
committed by Gerrit Code Review
3 changed files with 17 additions and 15 deletions

View File

@@ -4889,16 +4889,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);
}

View File

@@ -264,10 +264,10 @@ struct ast_format *ast_format_compatibility_bitfield2format(uint64_t bitfield)
/*! T.140 RED Text format RFC 4103 */
case AST_FORMAT_T140_RED:
return ast_format_t140;
return ast_format_t140_red;
/*! T.140 Text format - ITU T.140, RFC 4103 */
case AST_FORMAT_T140:
return ast_format_t140_red;
return ast_format_t140;
}
return NULL;
}