Merge branch 'mesa_7_5_branch'
[mesa.git] / src / gallium / auxiliary / util / u_memory.h
index 1a6b596421f0ed6960c6eb0176f9e7b6e5011599..0b18d043adb2a52cee9abc8961c3b17cd950b3b2 100644 (file)
@@ -36,7 +36,7 @@
 
 
 #include "util/u_pointer.h"
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 
 
 #ifdef __cplusplus
@@ -52,11 +52,11 @@ extern "C" {
 #endif
 
 
-#if defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) && defined(DEBUG) 
+#if defined(PIPE_OS_WINDOWS) && defined(DEBUG) 
 
 /* memory debugging */
 
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 
 #define MALLOC( _size ) \
    debug_malloc( __FILE__, __LINE__, __FUNCTION__, _size )
@@ -191,9 +191,11 @@ align_free(void *ptr)
 #if defined(HAVE_POSIX_MEMALIGN)
    FREE(ptr);
 #else
-   void **cubbyHole = (void **) ((char *) ptr - sizeof(void *));
-   void *realAddr = *cubbyHole;
-   FREE(realAddr);
+   if (ptr) {
+      void **cubbyHole = (void **) ((char *) ptr - sizeof(void *));
+      void *realAddr = *cubbyHole;
+      FREE(realAddr);
+   }
 #endif /* defined(HAVE_POSIX_MEMALIGN) */
 }