Skip to content

Commit 2683105

Browse files
committed
Fix valgrind
1 parent 10a8cbd commit 2683105

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

tool-openssl/asn1parse_test.cc

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,29 @@ struct TestCorpus {
1212
std::string name;
1313
std::string hex;
1414
std::string format;
15-
bool awslc_success;
16-
bool match_openssl;
15+
bool awslc_success = false;
16+
bool match_openssl = false;
17+
18+
// Constructor for explicit initialization
19+
TestCorpus(const std::string &n, const std::string &h, const std::string &f,
20+
bool aws_success, bool match_ssl)
21+
: name(n),
22+
hex(h),
23+
format(f),
24+
awslc_success(aws_success),
25+
match_openssl(match_ssl) {}
26+
27+
// Default constructor - explicitly initialize all members
28+
TestCorpus() : awslc_success(false), match_openssl(false) {}
1729
};
1830

31+
// Custom printer for TestCorpus to avoid GoogleTest's byte-level printing
32+
static void PrintTo(const TestCorpus &corpus, std::ostream *os) {
33+
*os << "TestCorpus{name=\"" << corpus.name << "\", format=\"" << corpus.format
34+
<< "\", awslc_success=" << (corpus.awslc_success ? "true" : "false")
35+
<< ", match_openssl=" << (corpus.match_openssl ? "true" : "false") << "}";
36+
}
37+
1938
#define FORMAT_PEM "PEM"
2039
#define FORMAT_DER "DER"
2140

0 commit comments

Comments
 (0)