Skip to contentSkip to conversation

master - cleanup: add va_end

PATCH Zdenek Kabelac 1 participant 1 message Aug 23, 2012

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=93f36fb77f595f67602cd9b39bb696e802545546
Commit:        93f36fb77f595f67602cd9b39bb696e802545546
Parent:        bd67a3151aa3a3202d52fcc9ffac781b96dca04a
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Fri Aug 17 00:46:00 2012 +0200
Committer:     Zdenek Kabelac <[email protected]>
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(-)
libdaemon/server/daemon-log.c +7 -5
index 8eab917..b18e70c 100644
@@ -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 {