removed core_strdup() usage from ti99 cartridge code (nw)

This commit is contained in:
firewave 2018-01-21 00:00:47 +01:00
parent fef11b9087
commit e89a090ace
2 changed files with 6 additions and 6 deletions

View File

@ -239,7 +239,7 @@ image_init_result ti99_cartridge_device::call_load()
}
catch (rpk_exception& err)
{
logerror("Failed to load cartridge '%s': %s\n", basename(), err.to_string());
logerror("Failed to load cartridge '%s': %s\n", basename(), err.to_string().c_str());
m_rpk = nullptr;
m_err = IMAGE_ERROR_INVALIDIMAGE;
return image_init_result::FAIL;

View File

@ -119,12 +119,12 @@ private:
rpk_exception(rpk_open_error value): m_err(value), m_detail(nullptr) { }
rpk_exception(rpk_open_error value, const char* detail) : m_err(value), m_detail(detail) { }
const char* to_string()
std::string to_string()
{
// FIXME: this leaks memory - in some cases it returns a new buffer, in other cases it returns a pointer to a static string, so the caller can't know whether it needs to be cleaned up
if (m_detail==nullptr) return error_text[(int)m_err];
std::string errormsg = std::string(error_text[(int)m_err]).append(": ").append(m_detail);
return core_strdup(errormsg.c_str());
std::string errmsg(error_text[(int)m_err]);
if (m_detail==nullptr)
return errmsg;
return errmsg.append(": ").append(m_detail);
}
private: