diff --git a/src/apps/mail/WIndex.cpp b/src/apps/mail/WIndex.cpp index 9a39c52c16..76b38da4ba 100644 --- a/src/apps/mail/WIndex.cpp +++ b/src/apps/mail/WIndex.cpp @@ -268,9 +268,14 @@ WIndex::_BlockCheck(void) if (fEntries < fMaxEntries) return B_OK; fBlocks = fEntries / fEntriesPerBlock + 1; - fEntryList = (uint8 *)realloc(fEntryList, fBlockSize * fBlocks); - if (!fEntryList) + uint8* tmpEntryList = (uint8 *)realloc(fEntryList, fBlockSize * fBlocks); + if (!tmpEntryList) { + free(fEntryList); + fEntryList = NULL; return B_ERROR; + } else { + fEntryList = tmpEntryList; + } return B_OK; }