Skip to content

Commit 4749841

Browse files
Avoid calling memset with nullptr parameter
PREfast checks for this now and decides that the pointer may be null, so the additional if statement protects against that.
1 parent 3e1a41a commit 4749841

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/Common/Memory/LargeHeapBlock.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,10 @@ LargeHeapBlock::ReleasePages(Recycler * recycler)
389389
#endif
390390

391391
#ifdef RECYCLER_FREE_MEM_FILL
392-
memset(blockStartAddress, DbgMemFill, AutoSystemInfo::PageSize * realPageCount);
392+
if(blockStartAddress != nullptr)
393+
{
394+
memset(blockStartAddress, DbgMemFill, AutoSystemInfo::PageSize * realPageCount);
395+
}
393396
#endif
394397
pageAllocator->Release(blockStartAddress, realPageCount, segment);
395398
RECYCLER_PERF_COUNTER_SUB(LargeHeapBlockPageSize, pageCount * AutoSystemInfo::PageSize);

0 commit comments

Comments
 (0)