diff options
| -rw-r--r-- | binaryview.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
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<QualifiedName, Ref<Ty map<QualifiedName, Ref<Type>>& variables, map<QualifiedName, Ref<Type>>& 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; |
