[lvm-devel] master - cleanup: add va_end

Zdenek Kabelac zkabelac at fedoraproject.org
Thu Aug 23 12:42:36 UTC 2012


Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=93f36fb77f595f67602cd9b39bb696e802545546
Commit:        93f36fb77f595f67602cd9b39bb696e802545546
Parent:        bd67a3151aa3a3202d52fcc9ffac781b96dca04a
Author:        Zdenek Kabelac <zkabelac at redhat.com>
AuthorDate:    Fri Aug 17 00:46:00 2012 +0200
Committer:     Zdenek Kabelac <zkabelac at redhat.com>
CommitterDate: Thu Aug 23 14:37:21 2012 +0200

cleanup: add va_end

Pair va_start with va_end.
---
 libdaemon/server/daemon-log.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/libdaemon/server/daemon-log.c b/libdaemon/server/daemon-log.c
index 8eab917..b18e70c 100644
--- a/libdaemon/server/daemon-log.c
+++ b/libdaemon/server/daemon-log.c
@@ -53,13 +53,15 @@ void daemon_log(log_state *s, int type, const char *message) {
 }
 
 void daemon_logf(log_state *s, int type, const char *fmt, ...) {
+	char *buf;
 	va_list ap;
+
 	va_start(ap, fmt);
-	char *buf;
-	if (dm_vasprintf(&buf, fmt, ap) < 0)
-		return; /* _0 */
-	daemon_log(s, type, buf);
-	dm_free(buf);
+	if (dm_vasprintf(&buf, fmt, ap) >= 0) {
+		daemon_log(s, type, buf);
+		dm_free(buf);
+	} /* else return_0 */
+	va_end(ap);
 }
 
 struct log_line_baton {




More information about the lvm-devel mailing list