summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorGeorge Joseph <gjoseph@digium.com>2017-01-26 10:23:14 -0600
committerGerrit Code Review <gerrit2@gerrit.digium.api>2017-01-26 10:23:14 -0600
commit96dbf54e971952bb99b6e80ddf8929340bd107d4 (patch)
tree58cc891e261972a4235d8e8d0a22c2be0aff5f2f /main
parent3abb17d1726be4f143fcd661800d91474c2421f8 (diff)
parent20aed30d9aa512584552ecb88e7336342c874b1c (diff)
Merge "T.140: Fix format ref and memory leaks."
Diffstat (limited to 'main')
-rw-r--r--main/channel.c10
-rw-r--r--main/format_compatibility.c4
2 files changed, 8 insertions, 6 deletions
diff --git a/main/channel.c b/main/channel.c
index 4f8471743..d916b7c05 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -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);
}
diff --git a/main/format_compatibility.c b/main/format_compatibility.c
index 84514ac8c..256d3a53c 100644
--- a/main/format_compatibility.c
+++ b/main/format_compatibility.c
@@ -262,10 +262,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;
}