diff options
| author | 2019-07-01 10:12:32 -0700 | |
|---|---|---|
| committer | 2019-07-01 10:12:32 -0700 | |
| commit | f658b2d8b3d83e82dcb32f5cffdbc9ccbb46f8fc (patch) | |
| tree | f099b5f8273fd5c8078d5753799b7ef527787560 /libs/binder/Parcel.cpp | |
| parent | 5f84db48879aaf38737398f2fff6eb5e62dc87bd (diff) | |
| parent | bfb94faeace647e6b61f105d28580148c4b2facd (diff) | |
[automerger] Free mObjects if no objects left to realloc on resize am: edd3e3d8f4 am: c0394a6662 am: fbdb526a6a am: 40d0133f6d am: 5ab710e476 am: c1aa15f04d
am: bfb94faeac
Change-Id: I5a79edc66eb729715b4752774463d7906a348318
Diffstat (limited to 'libs/binder/Parcel.cpp')
| -rw-r--r-- | libs/binder/Parcel.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp index 13555fd80d..59a363f8dd 100644 --- a/libs/binder/Parcel.cpp +++ b/libs/binder/Parcel.cpp @@ -2709,10 +2709,16 @@ status_t Parcel::continueWrite(size_t desired) } release_object(proc, *flat, this, &mOpenAshmemSize); } - binder_size_t* objects = - (binder_size_t*)realloc(mObjects, objectsSize*sizeof(binder_size_t)); - if (objects) { - mObjects = objects; + + if (objectsSize == 0) { + free(mObjects); + mObjects = nullptr; + } else { + binder_size_t* objects = + (binder_size_t*)realloc(mObjects, objectsSize*sizeof(binder_size_t)); + if (objects) { + mObjects = objects; + } } mObjectsSize = objectsSize; mNextObjectHint = 0; |