libsolc: Overhauls memory management.

This commit is contained in:
Christian Parpart
2019-12-11 15:17:39 +00:00
committed by Alex Beregszaszi
parent 69b06a456c
commit 8682af2216
6 changed files with 91 additions and 27 deletions
+2 -3
View File
@@ -60,9 +60,10 @@ bool containsError(Json::Value const& _compilerResult, string const& _type, stri
Json::Value compile(string const& _input, CStyleReadFileCallback _callback = nullptr)
{
string output(solidity_compile(_input.c_str(), _callback, nullptr));
// This should be safe given the above copies the output.
solidity_reset();
Json::Value ret;
BOOST_REQUIRE(jsonParseStrict(output, ret));
solidity_free();
return ret;
}
@@ -74,14 +75,12 @@ BOOST_AUTO_TEST_CASE(read_version)
{
string output(solidity_version());
BOOST_CHECK(output.find(VersionString) == 0);
solidity_free();
}
BOOST_AUTO_TEST_CASE(read_license)
{
string output(solidity_license());
BOOST_CHECK(output.find("GNU GENERAL PUBLIC LICENSE") != string::npos);
solidity_free();
}
BOOST_AUTO_TEST_CASE(standard_compilation)
+1 -1
View File
@@ -47,7 +47,7 @@ void FuzzerUtil::runCompiler(string const& _input, bool _quiet)
cout << "Output JSON: " << outputString << endl;
// This should be safe given the above copies the output.
solidity_free();
solidity_reset();
Json::Value output;
if (!jsonParseStrict(outputString, output))