summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-11-25 09:03:00 -0500
committerDavid Robillard <d@drobilla.net>2022-11-25 10:08:49 -0500
commit967f381ee5be01949b6c748b26173d50ed7a2ef0 (patch)
treecba4ec3562abaa254eb95d21c4c228eb0510225c /test
parent831be970d1ff5ddc10e6dbf0813779f49f5692ea (diff)
downloadzix-967f381ee5be01949b6c748b26173d50ed7a2ef0.tar.gz
zix-967f381ee5be01949b6c748b26173d50ed7a2ef0.tar.bz2
zix-967f381ee5be01949b6c748b26173d50ed7a2ef0.zip
Avoid dereference after null check
Diffstat (limited to 'test')
-rw-r--r--test/cpp/test_path_std.cpp7
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) {