diff options
| author | 2019-06-06 16:25:33 -0700 | |
|---|---|---|
| committer | 2019-06-06 16:25:33 -0700 | |
| commit | 811391ec14337e91954ecd03ce715ebeada9c108 (patch) | |
| tree | 9a9c7e06f497afca15168dcde77353fc21741d00 /libs/binder/Parcel.cpp | |
| parent | 271c3134256d4d4be07cb7974e8726bcc21283ab (diff) | |
| parent | 4f65d3377b9f3b83fa75b94ccc7b459b98376b11 (diff) | |
Merge "Free mObjects if no objects left to realloc on resize" into qt-dev
am: 4f65d3377b
Change-Id: I3157b38d1b2714822b7b3f37edb271628583397f
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 0e8945c03e..458961b70d 100644 --- a/libs/binder/Parcel.cpp +++ b/libs/binder/Parcel.cpp @@ -2823,10 +2823,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; |