aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2013-07-24 16:44:37 +0200
committerYang Tse <yangsita@gmail.com>2013-07-24 16:46:25 +0200
commit8c1e3bb7139bc960dab78a8cc537c082a98733e4 (patch)
tree19bc453ccaf76a6c2d548fe732f548d9253a6479 /lib
parent4fad1943a256fcfbbb74603ba22fe7377e59e003 (diff)
imap.c: imap_sendf() fix va_start/va_end matching
Diffstat (limited to 'lib')
-rw-r--r--lib/imap.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/imap.c b/lib/imap.c
index 3547a3467..ea175e6b9 100644
--- a/lib/imap.c
+++ b/lib/imap.c
@@ -2063,7 +2063,8 @@ static CURLcode imap_sendf(struct connectdata *conn, const char *fmt, ...)
struct imap_conn *imapc = &conn->proto.imapc;
char *taggedfmt;
va_list ap;
- va_start(ap, fmt);
+
+ DEBUGASSERT(fmt);
/* Calculate the next command ID wrapping at 3 digits */
imapc->cmdid = (imapc->cmdid + 1) % 1000;
@@ -2078,10 +2079,11 @@ static CURLcode imap_sendf(struct connectdata *conn, const char *fmt, ...)
return CURLE_OUT_OF_MEMORY;
/* Send the data with the tag */
+ va_start(ap, fmt);
result = Curl_pp_vsendf(&imapc->pp, taggedfmt, ap);
+ va_end(ap);
Curl_safefree(taggedfmt);
- va_end(ap);
return result;
}