diff --git a/base/src/parcel.cpp b/base/src/parcel.cpp index ddabc9c7906642ff2b9c79eb5b113a52f5ad132f..855f7cfe48fa18772d56a8e001f055bfb7f1ffc5 100644 --- a/base/src/parcel.cpp +++ b/base/src/parcel.cpp @@ -13,10 +13,9 @@ * limitations under the License. */ -#include +#include "parcel.h" #include "securec.h" #include "utils_log.h" -#include "parcel.h" namespace OHOS { @@ -581,7 +580,7 @@ bool Parcel::EnsureObjectsCapacity() size_t newCapacity = ((objectsCapacity_ + NEW_CAPACITY_ADD) * NEW_CAPACITY_MULTI) / NEW_CAPACITY_DIV; size_t newBytes = newCapacity * sizeof(binder_size_t); - void *newOffsets = allocator_->Realloc(objectOffsets_, newBytes); + void *newOffsets = realloc(objectOffsets_, newBytes); if (newOffsets == nullptr) { return false; } @@ -1132,22 +1131,7 @@ void DefaultAllocator::Dealloc(void *data) void *DefaultAllocator::Realloc(void *data, size_t newSize) { - if (newSize != 0) { - // newSize checked before Realloc. - void *newData = malloc(newSize); - if (newData != nullptr) { - if (data == nullptr) { - return newData; - } - if (memcpy_s(newData, newSize, data, malloc_usable_size(data)) == EOK) { - free(data); - return newData; - } - free(newData); - } - } - UTILS_LOGW("Realloc failed! newSize = %{public}zu", newSize); - return nullptr; + return realloc(data, newSize); } template