[svn-commits] tilghman: trunk r481 - /trunk/cdr_addon_mysql.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Nov 5 06:16:07 CST 2007


Author: tilghman
Date: Mon Nov  5 06:16:07 2007
New Revision: 481

URL: http://svn.digium.com/view/asterisk-addons?view=rev&rev=481
Log:
Fix regression with r471 when patch did not merge correctly.
Reported by: meneault
Patch by: meneault
Closes issue #11160

Modified:
    trunk/cdr_addon_mysql.c

Modified: trunk/cdr_addon_mysql.c
URL: http://svn.digium.com/view/asterisk-addons/trunk/cdr_addon_mysql.c?view=diff&rev=481&r1=480&r2=481
==============================================================================
--- trunk/cdr_addon_mysql.c (original)
+++ trunk/cdr_addon_mysql.c Mon Nov  5 06:16:07 2007
@@ -230,15 +230,15 @@
 		mysql_escape_string(uniqueid, cdr->uniqueid, strlen(cdr->uniqueid));
 	if (userfield && ((userfielddata = alloca(strlen(cdr->userfield) * 2 + 1)) != NULL))
 		mysql_escape_string(userfielddata, cdr->userfield, strlen(cdr->userfield));
-	if (src && ((src = alloca(strlen(cdr->src) * 2 + 1)) != NULL))
+	if ((src = alloca(strlen(cdr->src) * 2 + 1)) != NULL)
 		mysql_escape_string(src, cdr->src, strlen(cdr->src));
-	if (dst && ((dst = alloca(strlen(cdr->dst) * 2 + 1)) != NULL))
+	if ((dst = alloca(strlen(cdr->dst) * 2 + 1)) != NULL)
 		mysql_escape_string(dst, cdr->dst, strlen(cdr->dst));
-	if (accountcode && ((accountcode = alloca(strlen(cdr->accountcode) * 2 + 1)) != NULL))
+	if ((accountcode = alloca(strlen(cdr->accountcode) * 2 + 1)) != NULL)
 		mysql_escape_string(accountcode, cdr->accountcode, strlen(cdr->accountcode));
 
 	/* Check for all alloca failures above at once */
-	if ((!clid) || (!dcontext) || (!channel) || (!dstchannel) || (!lastapp) || (!lastdata) || (!src) || (!dst) || (!accountcode) || (loguniqueid && !uniqueid)) {
+	if ((!clid) || (!dcontext) || (!channel) || (!dstchannel) || (!lastapp) || (!lastdata) || (!src) || (!dst) || (!accountcode) || (loguniqueid && !uniqueid) || (userfield && !userfielddata)) {
 		ast_log(LOG_ERROR, "cdr_mysql:  Out of memory error (insert fails)\n");
 		ast_mutex_unlock(&mysql_lock);
 		return -1;




More information about the svn-commits mailing list