diff options
author | David Robillard <d@drobilla.net> | 2022-11-25 09:03:00 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-11-25 10:08:49 -0500 |
commit | 967f381ee5be01949b6c748b26173d50ed7a2ef0 (patch) | |
tree | cba4ec3562abaa254eb95d21c4c228eb0510225c | |
parent | 831be970d1ff5ddc10e6dbf0813779f49f5692ea (diff) | |
download | zix-967f381ee5be01949b6c748b26173d50ed7a2ef0.tar.gz zix-967f381ee5be01949b6c748b26173d50ed7a2ef0.tar.bz2 zix-967f381ee5be01949b6c748b26173d50ed7a2ef0.zip |
Avoid dereference after null check
-rw-r--r-- | test/cpp/test_path_std.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/test/cpp/test_path_std.cpp b/test/cpp/test_path_std.cpp index 0c8b2d7..50ccad4 100644 --- a/test/cpp/test_path_std.cpp +++ b/test/cpp/test_path_std.cpp @@ -473,10 +473,11 @@ main() } for (const auto& join : joins) { - const Path l = join.lhs ? Path{join.lhs} : Path{}; - const Path r = join.rhs ? Path{join.rhs} : Path{}; + char* const joined = zix_path_join(nullptr, join.lhs, join.rhs); + const Path l = join.lhs ? Path{join.lhs} : Path{}; + const Path r = join.rhs ? Path{join.rhs} : Path{}; - assert(equal(l / r, zix_path_join(nullptr, join.lhs, join.rhs))); + assert(equal(l / r, joined)); } for (const auto& relatives : lexical_relatives) { |