[Mesa-dev] [PATCH V2 11/17] mesa: Modified _mesa_buffer_data to use _mesa_align_malloc.

Siavash Eliasi siavashserver at gmail.com
Thu Nov 28 00:56:37 PST 2013


Revision 2:
- Fixed memory leak.
---
 src/mesa/main/bufferobj.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index b27f592..111bea3 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -416,9 +416,12 @@ _mesa_buffer_data( struct gl_context *ctx, GLenum target, GLsizeiptrARB size,
 {
    void * new_data;
 
-   (void) ctx; (void) target;
+   (void) target;
+
+   if (bufObj->Data)
+      _mesa_align_free( bufObj->Data );
 
-   new_data = _mesa_realloc( bufObj->Data, bufObj->Size, size );
+   new_data = _mesa_align_malloc( size, ctx->Const.MinMapBufferAlignment );
    if (new_data) {
       bufObj->Data = (GLubyte *) new_data;
       bufObj->Size = size;
-- 
1.8.4.2



More information about the mesa-dev mailing list