From 26be575e666ba0de46557d25b6b48cff6ffcbba7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Sat, 13 Feb 2021 22:44:42 +0100 Subject: [PATCH] Fix ASAN error in vectorstream_test --- test/vectorstream_test.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/vectorstream_test.cpp b/test/vectorstream_test.cpp index a028b69..663158c 100644 --- a/test/vectorstream_test.cpp +++ b/test/vectorstream_test.cpp @@ -103,11 +103,13 @@ static int vectorstream_test() std_stringstream << "testline: " << i << std::endl; } //Add final null to form a c string + my_vectorstream.swap_vector(myvector); myvector.push_back(0); - if(std::strcmp(&(my_vectorstream.vector()[0]), std_stringstream.str().c_str()) != 0){ + if(std::strcmp(&(myvector[0]), std_stringstream.str().c_str()) != 0){ return 1; } myvector.pop_back(); + my_vectorstream.swap_vector(myvector); for(int i = 0; i < 100; ++i){ my_vectorstream >> str1 >> number1; std_stringstream >> str2 >> number2;