diff --git a/src/ctx.c b/src/ctx.c index db40161..48e87ad 100644 --- a/src/ctx.c +++ b/src/ctx.c @@ -250,10 +250,13 @@ void xmpp_log(const xmpp_ctx_t * const ctx, int oldret, ret; char smbuf[1024]; char *buf; + va_list copy; buf = smbuf; + va_copy(copy, ap); ret = xmpp_vsnprintf(buf, 1023, fmt, ap); if (ret > 1023) { + va_copy(ap, copy); buf = (char *)xmpp_alloc(ctx, ret + 1); if (!buf) { buf = NULL;