diff options
author | Daiki Ueno <dueno@redhat.com> | 2018-10-16 18:06:56 +0200 |
---|---|---|
committer | Daiki Ueno <ueno@gnu.org> | 2018-10-17 10:13:32 +0200 |
commit | c76197ddbbd0c29adc2bceff2ee9f740f71d134d (patch) | |
tree | 6eab317dc5feeba8e9b6c7295d4f571260c34f8c /common | |
parent | 8a8db182af533a43b4d478d28af8623035475d68 (diff) |
build: Call va_end() always when leaving the function
Diffstat (limited to 'common')
-rw-r--r-- | common/attrs.c | 4 | ||||
-rw-r--r-- | common/compat.c | 5 | ||||
-rw-r--r-- | common/path.c | 5 |
3 files changed, 11 insertions, 3 deletions
diff --git a/common/attrs.c b/common/attrs.c index aa91891..a387a66 100644 --- a/common/attrs.c +++ b/common/attrs.c @@ -538,8 +538,10 @@ buffer_append_printf (p11_buffer *buffer, va_list va; va_start (va, format); - if (vasprintf (&string, format, va) < 0) + if (vasprintf (&string, format, va) < 0) { + va_end (va); return_if_reached (); + } va_end (va); p11_buffer_add (buffer, string, -1); diff --git a/common/compat.c b/common/compat.c index 5a9702d..48614fa 100644 --- a/common/compat.c +++ b/common/compat.c @@ -525,7 +525,10 @@ strconcat (const char *first, for (arg = first; arg; arg = va_arg (va, const char*)) { size_t old_length = length; length += strlen (arg); - return_val_if_fail (length >= old_length, NULL); + if (length < old_length) { + va_end (va); + return_val_if_reached (NULL); + } } va_end (va); diff --git a/common/path.c b/common/path.c index 5cf0e1a..17a6230 100644 --- a/common/path.c +++ b/common/path.c @@ -218,7 +218,10 @@ p11_path_build (const char *path, while (path != NULL) { size_t old_len = len; len += strlen (path) + 1; - return_val_if_fail (len >= old_len, NULL); + if (len < old_len) { + va_end (va); + return_val_if_reached (NULL); + } path = va_arg (va, const char *); } va_end (va); |