diff --git a/main/translate.c b/main/translate.c index ac9112e8182d6a5ce8f8b3c454b4ef141b6efd69..ce430ce9777bb47c750712f359f10fec59e96758 100644 --- a/main/translate.c +++ b/main/translate.c @@ -283,12 +283,6 @@ 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. @@ -315,7 +309,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(pvt)) { + if (t->newpvt && t->newpvt(pvt)) { ast_free(pvt); return NULL; }