Memory leak fixed

This commit is contained in:
Nekotekina 2014-12-01 03:41:01 +03:00
parent 697b699873
commit c61fe621b0
2 changed files with 27 additions and 35 deletions

View File

@ -2,42 +2,36 @@
#include "Emu/System.h"
#include "PSVFuncList.h"
std::vector<psv_func> g_psv_func_list = []() -> std::vector<psv_func>
{
std::vector<psv_func> v;
std::vector<psv_func> g_psv_func_list;
psv_func unimplemented =
void add_psv_func(psv_func& data)
{
if (!g_psv_func_list.size())
{
0x00000000, // must not be a valid id
"INVALID FUNCTION",
new psv_func_detail::func_binder<u32>([]() -> u32
psv_func unimplemented;
unimplemented.nid = 0x00000000; // must not be a valid id
unimplemented.name = "INVALID FUNCTION (0x0)";
unimplemented.func.reset(new psv_func_detail::func_binder<u32>([]() -> u32
{
LOG_ERROR(HLE, "Unimplemented function executed");
Emu.Pause();
return 0xffffffffu;
}),
nullptr,
};
v.push_back(unimplemented);
}));
g_psv_func_list.push_back(unimplemented);
psv_func hle_return =
{
0x00000001, // must not be a valid id
"INVALID FUNCTION",
new psv_func_detail::func_binder<void, ARMv7Thread&>([](ARMv7Thread& CPU)
psv_func hle_return;
hle_return.nid = 0x00000001; // must not be a valid id
hle_return.name = "INVALID FUNCTION (0x1)";
hle_return.func.reset(new psv_func_detail::func_binder<void, ARMv7Thread&>([](ARMv7Thread& CPU)
{
CPU.FastStop();
}),
nullptr,
};
v.push_back(hle_return);
return v;
}();
return;
}));
g_psv_func_list.push_back(hle_return);
}
void add_psv_func(psv_func& data)
{
g_psv_func_list.push_back(data);
}

View File

@ -643,10 +643,10 @@ namespace psv_func_detail
struct psv_func
{
const u32 nid;
const char* const name;
psv_func_caller* const func;
psv_log_base* const module;
u32 nid;
const char* name;
std::shared_ptr<psv_func_caller> func;
psv_log_base* module;
};
void add_psv_func(psv_func& data);
@ -654,13 +654,11 @@ void add_psv_func(psv_func& data);
template<typename RT, typename... T>
void reg_psv_func(u32 nid, psv_log_base* module, const char* name, RT(*func)(T...))
{
psv_func f =
{
nid,
name,
new psv_func_detail::func_binder<RT, T...>(func),
module
};
psv_func f;
f.nid = nid;
f.name = name;
f.func.reset(new psv_func_detail::func_binder<RT, T...>(func));
f.module = module;
add_psv_func(f);
}