fix context core because of double free
This commit is contained in:
committed by
ob-robot
parent
f966aaa116
commit
6ed7e537a0
@ -125,8 +125,14 @@ public:
|
|||||||
struct ObContextUnit
|
struct ObContextUnit
|
||||||
{
|
{
|
||||||
inline void free(common::ObIAllocator &alloc) {
|
inline void free(common::ObIAllocator &alloc) {
|
||||||
alloc.free(value_.ptr());
|
if (nullptr != value_.ptr()) {
|
||||||
alloc.free(attribute_.ptr());
|
alloc.free(value_.ptr());
|
||||||
|
value_.reset();
|
||||||
|
}
|
||||||
|
if (nullptr != attribute_.ptr()) {
|
||||||
|
alloc.free(attribute_.ptr());
|
||||||
|
attribute_.reset();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
int deep_copy(const common::ObString &attribute,
|
int deep_copy(const common::ObString &attribute,
|
||||||
const common::ObString &value,
|
const common::ObString &value,
|
||||||
@ -136,6 +142,7 @@ struct ObContextUnit
|
|||||||
SQL_ENG_LOG(WARN, "failed to copy attribute", K(ret));
|
SQL_ENG_LOG(WARN, "failed to copy attribute", K(ret));
|
||||||
} else if (OB_FAIL(ob_write_string(alloc, value, value_))) {
|
} else if (OB_FAIL(ob_write_string(alloc, value, value_))) {
|
||||||
alloc.free(attribute_.ptr());
|
alloc.free(attribute_.ptr());
|
||||||
|
attribute_.reset();
|
||||||
SQL_ENG_LOG(WARN, "failed to copy value", K(ret));
|
SQL_ENG_LOG(WARN, "failed to copy value", K(ret));
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
@ -458,9 +465,11 @@ struct ObInnerContextMap {
|
|||||||
if (OB_NOT_NULL(context_map_)) {
|
if (OB_NOT_NULL(context_map_)) {
|
||||||
context_map_->destroy();
|
context_map_->destroy();
|
||||||
alloc_.free(context_map_);
|
alloc_.free(context_map_);
|
||||||
|
context_map_ = nullptr;
|
||||||
}
|
}
|
||||||
if (OB_NOT_NULL(context_name_.ptr())) {
|
if (OB_NOT_NULL(context_name_.ptr())) {
|
||||||
alloc_.free(context_name_.ptr());
|
alloc_.free(context_name_.ptr());
|
||||||
|
context_name_.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int init()
|
int init()
|
||||||
|
|||||||
Reference in New Issue
Block a user