Make use of va_args more appropriate to form in various res_config modules plus utils.

A number of va_copy operations weren't matched with a corresponding va_end in res_config_odbc. Also, there was a potential for va_end to be invoked twice on the same va_arg in utils, which would mean invoking va_end on an undefined variable... which is bad.
va_end is removed from various functions in config_pgsql and config_curl since they aren't making their own copy.  The invokers of those functions are responsible for calling va_end on them.

(issue ASTERISK-19451)
Reported by: Walter Doekes
Review: https://reviewboard.asterisk.org/r/1848/


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@362354 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Jonathan Rose
2012-04-17 20:43:22 +00:00
parent 8cbe9f9fa7
commit bcd63be3cd
4 changed files with 46 additions and 48 deletions

View File

@@ -1755,8 +1755,6 @@ void __ast_string_field_ptr_build_va(struct ast_string_field_mgr *mgr,
needed = vsnprintf(target, available, format, ap1) + 1;
va_end(ap1);
if (needed > available) {
/* the allocation could not be satisfied using the field's current allocation
(if it has one), or the space available in the pool (if it does not). allocate