[asterisk-commits] mmichelson: trunk r247076 - /trunk/main/strings.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Feb 16 17:44:36 CST 2010


Author: mmichelson
Date: Tue Feb 16 17:44:33 2010
New Revision: 247076

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=247076
Log:
Add va_end calls to __ast_str_helper.

According to the man page for stdarg(3),
"Each invocation of va_copy() must be matched by a
corresponding invocation of va_end() in the same
function."

There were several cases in __ast_str_helper where
va_copy was not matched with a corresponding call
to va_end.


Modified:
    trunk/main/strings.c

Modified: trunk/main/strings.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/strings.c?view=diff&rev=247076&r1=247075&r2=247076
==============================================================================
--- trunk/main/strings.c (original)
+++ trunk/main/strings.c Tue Feb 16 17:44:33 2010
@@ -93,6 +93,7 @@
 #endif
 				) {
 				ast_verbose("failed to extend from %d to %d\n", (int)(*buf)->__AST_STR_LEN, need);
+				va_end(aq);
 				return AST_DYNSTR_BUILD_FAILED;
 			}
 			(*buf)->__AST_STR_STR[offset] = '\0';	/* Truncate the partial write. */
@@ -101,6 +102,7 @@
 			va_end(aq);
 			continue;
 		}
+		va_end(aq);
 		break;
 	} while (1);
 	/* update space used, keep in mind the truncation */




More information about the asterisk-commits mailing list