[to #53220315] fix opaque deep copy memory leak
This commit is contained in:
@ -8803,6 +8803,7 @@ int ObSPIService::spi_copy_opaque(
|
|||||||
ObPLOpaque &src, ObPLOpaque *&dest, uint64_t package_id)
|
ObPLOpaque &src, ObPLOpaque *&dest, uint64_t package_id)
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
|
bool is_new_opaque = false;
|
||||||
UNUSEDx(ctx, package_id);
|
UNUSEDx(ctx, package_id);
|
||||||
if (NULL == dest) {
|
if (NULL == dest) {
|
||||||
CK (OB_NOT_NULL(allocator));
|
CK (OB_NOT_NULL(allocator));
|
||||||
@ -8811,6 +8812,7 @@ int ObSPIService::spi_copy_opaque(
|
|||||||
LOG_WARN("failed to alloc memory for dest opaque", K(ret), K(src.get_init_size()));
|
LOG_WARN("failed to alloc memory for dest opaque", K(ret), K(src.get_init_size()));
|
||||||
}
|
}
|
||||||
OX (new (dest)ObPLOpaque());
|
OX (new (dest)ObPLOpaque());
|
||||||
|
OX (is_new_opaque = true);
|
||||||
}
|
}
|
||||||
if (OB_SUCC(ret)) {
|
if (OB_SUCC(ret)) {
|
||||||
switch (src.get_type()) {
|
switch (src.get_type()) {
|
||||||
@ -8834,6 +8836,10 @@ int ObSPIService::spi_copy_opaque(
|
|||||||
OZ (src.deep_copy(dest));
|
OZ (src.deep_copy(dest));
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
|
if (OB_FAIL(ret) && is_new_opaque) {
|
||||||
|
dest->~ObPLOpaque();
|
||||||
|
dest = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user