]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 247076 via svnmerge from
authorMark Michelson <mmichelson@digium.com>
Tue, 16 Feb 2010 23:46:41 +0000 (23:46 +0000)
committerMark Michelson <mmichelson@digium.com>
Tue, 16 Feb 2010 23:46:41 +0000 (23:46 +0000)
https://origsvn.digium.com/svn/asterisk/trunk

........
  r247076 | mmichelson | 2010-02-16 17:44:33 -0600 (Tue, 16 Feb 2010) | 12 lines

  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.
........

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.2@247079 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/strings.c

index 2e4b749c97c3deaf71867a54f6bfc08c5f339834..f3e3d34cddaf8379eab7fe5ccbd02449cc43d809 100644 (file)
@@ -93,6 +93,7 @@ int __ast_str_helper(struct ast_str **buf, size_t max_len,
 #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 @@ int __ast_str_helper(struct ast_str **buf, size_t max_len,
                        va_end(aq);
                        continue;
                }
+               va_end(aq);
                break;
        } while (1);
        /* update space used, keep in mind the truncation */