[PATCH 2/5] add leaks due to missing invocations of va_end

Piotr Trojanek piotr.trojanek at gmail.com
Fri Jun 16 15:50:23 PDT 2017


As the Linux man page states: "Each invocation of va_start() must be
matched by a corresponding invocation of va_end() in the same
function." Detected by cppcheck.
---
 tag-util.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git tag-util.c tag-util.c
index 7091d294..30c2c077 100644
--- tag-util.c
+++ tag-util.c
@@ -28,6 +28,9 @@ line_error (tag_parse_status_t status,
     fprintf (stderr, status < 0 ? "Error: " : "Warning: ");
     vfprintf (stderr, format, va_args);
     fprintf (stderr, " [%s]\n", line);
+
+    va_end (va_args);
+
     return status;
 }
 
@@ -200,6 +203,8 @@ message_error (notmuch_message_t *message,
     vfprintf (stderr, format, va_args);
     fprintf (stderr, "Message-ID: %s\n", notmuch_message_get_message_id (message));
     fprintf (stderr, "Status: %s\n", notmuch_status_to_string (status));
+
+    va_end (va_args);
 }
 
 static int
-- 
2.11.0



More information about the notmuch mailing list