Skip to content

Commit 91de04f

Browse files
Allow alloc growth to be inclusive of max size
1 parent e18ea7b commit 91de04f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

android-database-sqlcipher/src/main/cpp/CursorWindow.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,10 @@ uint32_t CursorWindow::alloc(size_t requestedSize, bool aligned)
122122
}
123123
size = requestedSize + padding;
124124
if (size > freeSpace()) {
125-
LOGE("need to grow: mSize = %d, size = %d, freeSpace() = %d, numRows = %d\n",
126-
mSize, size, freeSpace(), mHeader->numRows);
127125
new_allocation_sz = mSize + size - freeSpace() + mGrowthPaddingSize;
128-
if(mMaxSize == 0 || new_allocation_sz < mMaxSize) {
126+
LOGE("need to grow: mSize = %d, size = %d, freeSpace() = %d, numRows = %d new_allocation_sz:%d\n",
127+
mSize, size, freeSpace(), mHeader->numRows, new_allocation_sz);
128+
if(mMaxSize == 0 || new_allocation_sz <= mMaxSize) {
129129
tempData = realloc((void *)mData, new_allocation_sz);
130130
if(tempData == NULL) return 0;
131131
mData = (uint8_t *)tempData;

0 commit comments

Comments
 (0)