From: Brian Paul Date: Thu, 5 Mar 2009 17:01:17 +0000 (-0700) Subject: gallium: added null ptr check in align_free() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ca640ca9598c22970b15bf16acf74409d860a30a;p=mesa.git gallium: added null ptr check in align_free() --- 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) */ }