From 967f381ee5be01949b6c748b26173d50ed7a2ef0 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 25 Nov 2022 09:03:00 -0500 Subject: Avoid dereference after null check --- test/cpp/test_path_std.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'test/cpp/test_path_std.cpp') 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) { -- cgit v1.2.1