aboutsummaryrefslogtreecommitdiffstats
path: root/main/channel.c
diff options
context:
space:
mode:
Diffstat (limited to 'main/channel.c')
-rw-r--r--main/channel.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/main/channel.c b/main/channel.c
index d830f1f8b..71214a0e4 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -427,15 +427,20 @@ static int ast_check_hangup_locked(struct ast_channel *chan)
/*! \brief printf the string into a correctly sized mallocd buffer, and return the buffer */
char *ast_safe_string_alloc(const char *fmt, ...)
{
- char *b2,buf[1];
+ char *b2, buf[1];
int len;
-
va_list args;
+
va_start(args, fmt);
len = vsnprintf(buf, 1, fmt, args);
- b2 = ast_malloc(len+1);
- vsnprintf(b2, len+1, fmt, args);
va_end(args);
+
+ b2 = ast_malloc(len + 1);
+
+ va_start(args, fmt);
+ vsnprintf(b2, len + 1, fmt, args);
+ va_end(args);
+
return b2;
}