From a29956a6896c7ff8ce05f80d7f9341ebf59c9db9 Mon Sep 17 00:00:00 2001
From: Bryce Poole <Bryce.Poole@intel.com>
Date: Tue, 29 May 2012 15:16:42 -0700
Subject: [PATCH] Modified local_surface_pool to deallocate the buffer with "free" if it
 was allocated by posix_memalign.

---
 src/core/local_surface_pool.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/core/local_surface_pool.c b/src/core/local_surface_pool.c
index c3dd6c9..308498a 100644
--- a/src/core/local_surface_pool.c
+++ b/src/core/local_surface_pool.c
@@ -196,7 +196,11 @@ localDeallocateBuffer( CoreSurfacePool       *pool,
      D_MAGIC_ASSERT( pool, CoreSurfacePool );
      D_MAGIC_ASSERT( alloc, LocalAllocationData );
 
-     D_FREE( alloc->addr );
+     if (dfb_config->system_surface_align_base && dfb_config->system_surface_align_pitch) 
+          // This was allocated by posix_memalign and requires "free()".
+          free( alloc->addr );
+     else
+          D_FREE( alloc->addr );
 
      D_MAGIC_CLEAR( alloc );
 
-- 
1.7.4.1

