diff options
author | David Robillard <d@drobilla.net> | 2020-09-27 18:10:31 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-09-27 18:10:31 +0200 |
commit | de095162e5e71fd74453564e9efc9a3c43209116 (patch) | |
tree | 43931361940139692be177f6aceb24067b4192aa | |
parent | 4d4222c583f6169159bb9d02868488ea03569aad (diff) | |
download | lv2-de095162e5e71fd74453564e9efc9a3c43209116.tar.xz |
Fix leaked va_lists
-rw-r--r-- | .clang-tidy | 1 | ||||
-rw-r--r-- | lv2/atom/util.h | 6 | ||||
-rw-r--r-- | lv2/core/lv2_util.h | 2 |
3 files changed, 8 insertions, 1 deletions
diff --git a/.clang-tidy b/.clang-tidy index c147b83..168695f 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -4,7 +4,6 @@ Checks: > -*-narrowing-conversions, -*-uppercase-literal-suffix, -bugprone-macro-parentheses, - -clang-analyzer-valist.Unterminated, -clang-diagnostic-empty-translation-unit, -clang-diagnostic-unused-function, -clang-diagnostic-unused-macros, diff --git a/lv2/atom/util.h b/lv2/atom/util.h index 383d304..6f3158f 100644 --- a/lv2/atom/util.h +++ b/lv2/atom/util.h @@ -371,6 +371,7 @@ lv2_atom_object_body_get(uint32_t size, const LV2_Atom_Object_Body* body, ...) va_start(args, body); for (n_queries = 0; va_arg(args, uint32_t); ++n_queries) { if (!va_arg(args, const LV2_Atom**)) { + va_end(args); return -1; } } @@ -384,6 +385,7 @@ lv2_atom_object_body_get(uint32_t size, const LV2_Atom_Object_Body* body, ...) if (qkey == prop->key && !*qval) { *qval = &prop->value; if (++matches == n_queries) { + va_end(args); return matches; } break; @@ -424,6 +426,7 @@ lv2_atom_object_get(const LV2_Atom_Object* object, ...) va_start(args, object); for (n_queries = 0; va_arg(args, uint32_t); ++n_queries) { if (!va_arg(args, const LV2_Atom**)) { + va_end(args); return -1; } } @@ -437,6 +440,7 @@ lv2_atom_object_get(const LV2_Atom_Object* object, ...) if (qkey == prop->key && !*qval) { *qval = &prop->value; if (++matches == n_queries) { + va_end(args); return matches; } break; @@ -479,6 +483,7 @@ lv2_atom_object_get_typed(const LV2_Atom_Object* object, ...) for (n_queries = 0; va_arg(args, uint32_t); ++n_queries) { if (!va_arg(args, const LV2_Atom**) || !va_arg(args, uint32_t)) { + va_end(args); return -1; } } @@ -493,6 +498,7 @@ lv2_atom_object_get_typed(const LV2_Atom_Object* object, ...) if (!*qval && qkey == prop->key && qtype == prop->value.type) { *qval = &prop->value; if (++matches == n_queries) { + va_end(args); return matches; } break; diff --git a/lv2/core/lv2_util.h b/lv2/core/lv2_util.h index 0792941..0269c70 100644 --- a/lv2/core/lv2_util.h +++ b/lv2/core/lv2_util.h @@ -86,10 +86,12 @@ lv2_features_query(const LV2_Feature* const* features, ...) *data = lv2_features_data(features, uri); if (required && !*data) { + va_end(args); return uri; } } + va_end(args); return NULL; } |