only clear it when the buffer is valid
authorChristoph von Wittich <christoph_vw@reactos.org>
Wed, 12 Dec 2007 09:17:59 +0000 (09:17 +0000)
committerChristoph von Wittich <christoph_vw@reactos.org>
Wed, 12 Dec 2007 09:17:59 +0000 (09:17 +0000)
svn path=/trunk/; revision=31179

reactos/boot/freeldr/freeldr/reactos/archwsup.c

index f59e0be..4a48481 100644 (file)
@@ -29,13 +29,14 @@ FldrpHwHeapAlloc(IN ULONG Size)
     /* Return a block of memory from the ARC Hardware Heap */
     Buffer = &reactos_arc_hardware_data[FldrpHwHeapLocation];
     
-    /* Clear it */
-    RtlZeroMemory(Buffer, Size);
-    
     /* Increment the heap location */
     FldrpHwHeapLocation += Size;
     if (FldrpHwHeapLocation > HW_MAX_ARC_HEAP_SIZE) Buffer = NULL;
-    
+
+    /* Clear it */
+    if (Buffer)
+        RtlZeroMemory(Buffer, Size);
+
     /* Return the buffer */
     return Buffer;
 }