diff --git a/libevmasm/Assembly.cpp b/libevmasm/Assembly.cpp index 034b66bd5..96cd792aa 100644 --- a/libevmasm/Assembly.cpp +++ b/libevmasm/Assembly.cpp @@ -173,7 +173,12 @@ AssemblyItem Assembly::createAssemblyItemFromJSON(Json::Value const& _json, std: solRequire(srcIndex >= -1 && srcIndex < static_cast(_sourceList.size()), AssemblyImportException, "srcIndex out of bound."); if (srcIndex != -1) - location.sourceName = std::make_shared(_sourceList[static_cast(srcIndex)]); + { + static map> sharedSourceNames; + if (sharedSourceNames.find(_sourceList[static_cast(srcIndex)]) == sharedSourceNames.end()) + sharedSourceNames[_sourceList[static_cast(srcIndex)]] = std::make_shared(_sourceList[static_cast(srcIndex)]); + location.sourceName = sharedSourceNames[_sourceList[static_cast(srcIndex)]]; + } AssemblyItem result(0);