The realloc case in continueWrite should not increment the counter,
the pointer passed to realloc is guaranteed to be non-NULL so the total
number of allocations will not have changed.
When realloc is called in restartWrite mData has not been checked
against NULL, increment the counter if it was NULL.
Bug:
26086286
Change-Id: I4c8af450cca1868b91793c0c5f0d8c4b4b5badbe
pthread_mutex_lock(&gParcelGlobalAllocSizeLock);
gParcelGlobalAllocSize += desired;
gParcelGlobalAllocSize -= mDataCapacity;
+ if (!mData) {
+ gParcelGlobalAllocCount++;
+ }
pthread_mutex_unlock(&gParcelGlobalAllocSizeLock);
mData = data;
mDataCapacity = desired;
pthread_mutex_lock(&gParcelGlobalAllocSizeLock);
gParcelGlobalAllocSize += desired;
gParcelGlobalAllocSize -= mDataCapacity;
- gParcelGlobalAllocCount++;
pthread_mutex_unlock(&gParcelGlobalAllocSizeLock);
mData = data;
mDataCapacity = desired;