[asterisk-commits] seanbright: trunk r378248 - /trunk/main/translate.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jan 1 11:04:05 CST 2013


Author: seanbright
Date: Tue Jan  1 11:03:59 2013
New Revision: 378248

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=378248
Log:
Bail out early when building an ast_trans_pvt and the translator doesn't supply a 'newpvt'

Modified:
    trunk/main/translate.c

Modified: trunk/main/translate.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/translate.c?view=diff&rev=378248&r1=378247&r2=378248
==============================================================================
--- trunk/main/translate.c (original)
+++ trunk/main/translate.c Tue Jan  1 11:03:59 2013
@@ -282,6 +282,12 @@
 	struct ast_trans_pvt *pvt;
 	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,
@@ -309,7 +315,7 @@
 		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;
 	}




More information about the asterisk-commits mailing list