diff options
author | Sean Bright <sean@malleable.com> | 2013-01-01 17:03:59 +0000 |
---|---|---|
committer | Sean Bright <sean@malleable.com> | 2013-01-01 17:03:59 +0000 |
commit | 9c20603dfcf9c4d4cc355c7a68a383640556fc2c (patch) | |
tree | 20fb315faef4811ac87d2d396f40c0b2b0343c49 | |
parent | 32472eca7058a03703d09cf58bf2ce1ff901c42a (diff) |
Bail out early when building an ast_trans_pvt and the translator doesn't supply a 'newpvt'
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@378248 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r-- | main/translate.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/main/translate.c b/main/translate.c index ce430ce97..ac9112e81 100644 --- a/main/translate.c +++ b/main/translate.c @@ -283,6 +283,12 @@ static void *newpvt(struct ast_translator *t, const struct ast_format *explicit_ int len; char *ofs; + /* If we don't have a local init routine, don't bother building the + ast_trans_pvt */ + if (!t->newpvt) { + return NULL; + } + /* * compute the required size adding private descriptor, * buffer, AST_FRIENDLY_OFFSET. @@ -309,7 +315,7 @@ static void *newpvt(struct ast_translator *t, const struct ast_format *explicit_ ast_format_copy(&pvt->explicit_dst, explicit_dst); } /* call local init routine, if present */ - if (t->newpvt && t->newpvt(pvt)) { + if (t->newpvt(pvt)) { ast_free(pvt); return NULL; } |