dovecot-2.2-pigeonhole: lib: pair VA_COPY with va_end.

pigeonhole at rename-it.nl pigeonhole at rename-it.nl
Tue Jun 17 18:58:32 UTC 2014


details:   http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/a2a8fb3cea09
changeset: 1865:a2a8fb3cea09
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Tue Jun 17 20:35:18 2014 +0200
description:
lib: pair VA_COPY with va_end.
A va_copy creates a initialised va_list, as if a va_start had been done on it.
Therefore, pedantically, a va_end should also be done on it. On most platforms
this is a no-op, and for those where it isn't, the pairing is important.

This change matches parallel change in Dovecot. Also signalled by Coverity.

diffstat:

 src/lib-sieve/sieve-error.c   |  6 ++++--
 src/testsuite/testsuite-log.c |  3 ++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diffs (61 lines):

diff -r 6a0376f1a7d2 -r a2a8fb3cea09 src/lib-sieve/sieve-error.c
--- a/src/lib-sieve/sieve-error.c	Thu May 15 19:48:27 2014 +0200
+++ b/src/lib-sieve/sieve-error.c	Tue Jun 17 20:35:18 2014 +0200
@@ -96,6 +96,7 @@
 						(svinst->system_ehandler, 0, location, fmt, args_copy);
 				}
 			}
+			va_end(args_copy);
 		}
 		if (svinst->system_ehandler == ehandler)
 			return;
@@ -137,6 +138,7 @@
 						(svinst->system_ehandler, 0, location, fmt, args_copy);
 				}
 			}
+			va_end(args_copy);
 		}
 		if (svinst->system_ehandler == ehandler)
 			return;
@@ -164,9 +166,9 @@
 			va_list args_copy;
 
 			VA_COPY(args_copy, args);
-
 			svinst->system_ehandler->vinfo
 				(svinst->system_ehandler, 0, location, fmt, args_copy);
+			va_end(args_copy);
 		}
 	}
 
@@ -191,9 +193,9 @@
 			va_list args_copy;
 
 			VA_COPY(args_copy, args);
-
 			svinst->system_ehandler->vdebug
 				(svinst->system_ehandler, 0, location, fmt, args_copy);
+			va_end(args_copy);
 		}
 	}
 
diff -r 6a0376f1a7d2 -r a2a8fb3cea09 src/testsuite/testsuite-log.c
--- a/src/testsuite/testsuite-log.c	Thu May 15 19:48:27 2014 +0200
+++ b/src/testsuite/testsuite-log.c	Tue Jun 17 20:35:18 2014 +0200
@@ -41,14 +41,15 @@
 {
 	if ( _testsuite_log_stdout ) {
 		va_list args_copy;
+
 		VA_COPY(args_copy, args);
-
 		if ( location == NULL || *location == '\0' )
 			fprintf(stdout,
 				"LOG: %s: %s\n", prefix, t_strdup_vprintf(fmt, args_copy));
 		else
 			fprintf(stdout,
 				"LOG: %s: %s: %s\n", prefix, location, t_strdup_vprintf(fmt, args_copy));
+		va_end(args_copy);
 	}
 }
 


More information about the dovecot-cvs mailing list