[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/3] Check for zero byte allocations



Dont attempt to allocate zero byte buffers, as it can pollute the pool
headers without benefit.

Suggested-by: Matthew Sykes <matthew.sykes@xxxxxxxxxx>
Signed-off-by: Owen Smith <owen.smith@xxxxxxxxx>
---
 src/xeniface/util.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/xeniface/util.h b/src/xeniface/util.h
index 71c887d..a278d72 100644
--- a/src/xeniface/util.h
+++ b/src/xeniface/util.h
@@ -153,6 +153,9 @@ __AllocatePoolWithTag(
     __analysis_assume(PoolType == NonPagedPool ||
                       PoolType == PagedPool);
 
+    if (NumberOfBytes == 0)
+        return NULL;
+
 #if (_MSC_VER >= 1928) // VS 16.9 (EWDK 20344 or later)
     Buffer = ExAllocatePoolUninitialized(PoolType, NumberOfBytes, Tag);
 #else
-- 
2.39.0.windows.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.