From 71515ba190e90e0250b9de23b7ba871c1dd44f09 Mon Sep 17 00:00:00 2001 From: Andrew Kroeger Date: Fri, 12 Jun 2009 13:01:41 +0200 Subject: s4: Call va_end() after all va_start()/va_copy() calls. This corrects the issues reaised in bug #6129, and some others that were not originally identified. It also accounts for some code that was in the original bug report but appears to have since been made common between S3 and S4. Thanks to Erik Hovland for the original bug report. --- examples/libsmbclient/smbwrapper/smbw.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'examples') diff --git a/examples/libsmbclient/smbwrapper/smbw.c b/examples/libsmbclient/smbwrapper/smbw.c index e2e44c1f0f..1356c78d04 100644 --- a/examples/libsmbclient/smbwrapper/smbw.c +++ b/examples/libsmbclient/smbwrapper/smbw.c @@ -55,12 +55,9 @@ smbw_ref -- manipulate reference counts ******************************************************/ int smbw_ref(int client_fd, Ref_Count_Type type, ...) { - va_list ap; - /* client id values begin at SMBC_BASE_FC. */ client_fd -= SMBC_BASE_FD; - va_start(ap, type); switch(type) { case SMBW_RCT_Increment: @@ -73,9 +70,16 @@ int smbw_ref(int client_fd, Ref_Count_Type type, ...) return smbw_ref_count[client_fd]; case SMBW_RCT_Set: - return (smbw_ref_count[client_fd] = va_arg(ap, int)); + { + va_list ap; + int ret; + + va_start(ap, type); + ret = (smbw_ref_count[client_fd] = va_arg(ap, int)); + va_end(ap); + return ret; + } } - va_end(ap); /* never gets here */ return -1; -- cgit