From 8acc69ae58185d54da01ac154aa0140c2d53e623 Mon Sep 17 00:00:00 2001 From: Peter LaFosse Date: Tue, 30 Jun 2020 11:05:22 -0400 Subject: Fix crash in BinaryView::ParseTypeString --- binaryview.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'binaryview.cpp') diff --git a/binaryview.cpp b/binaryview.cpp index 287dc94b..a9b25a3c 100644 --- a/binaryview.cpp +++ b/binaryview.cpp @@ -2470,15 +2470,18 @@ bool BinaryView::ParseTypeString(const string& source, map>& variables, map>& functions, string& errors) { BNTypeParserResult result; - char* errorStr; + char* errorStr = nullptr; types.clear(); variables.clear(); functions.clear(); bool ok = BNParseTypesString(m_object, source.c_str(), &result, &errorStr); - errors = errorStr; - BNFreeString(errorStr); + if (errorStr) + { + errors = errorStr; + BNFreeString(errorStr); + } if (!ok) return false; -- cgit v1.3.1