summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-03-05 10:01:17 -0700
committerBrian Paul <[email protected]>2009-03-05 10:01:28 -0700
commitca640ca9598c22970b15bf16acf74409d860a30a (patch)
tree77f78eb128e31fe1379473741d38bdc8fe23a975 /src/gallium/auxiliary
parent3ba370ad7f3dce225503978022ff85a00713f0cf (diff)
gallium: added null ptr check in align_free()
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/util/u_memory.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/util/u_memory.h b/src/gallium/auxiliary/util/u_memory.h
index ceb3a1cb615..0b18d043adb 100644
--- a/src/gallium/auxiliary/util/u_memory.h
+++ b/src/gallium/auxiliary/util/u_memory.h
@@ -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) */
}