提交 e4a2a9d4 编写于 作者: X xulongteng

Fix memory leak

Change-Id: I5297891f3002f851c3eb0988205f2abf108572f5
上级 0ab2fd63
...@@ -28,6 +28,16 @@ struct MempoolRegion { ...@@ -28,6 +28,16 @@ struct MempoolRegion {
im::fugue::memory::Region* _region; im::fugue::memory::Region* _region;
im::Mempool* _mempool; im::Mempool* _mempool;
~MempoolRegion() {
if (_region) {
delete _region;
_region = NULL;
}
if (_mempool) {
delete _mempool;
_mempool = NULL;
}
}
}; };
int MempoolWrapper::initialize() { int MempoolWrapper::initialize() {
...@@ -57,6 +67,7 @@ int MempoolWrapper::thread_initialize() { ...@@ -57,6 +67,7 @@ int MempoolWrapper::thread_initialize() {
LOG(ERROR) << "unable to set the thrd_data"; LOG(ERROR) << "unable to set the thrd_data";
delete region; delete region;
delete mempool; delete mempool;
delete mempool_region;
return -1; return -1;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册