aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSiavash Eliasi <[email protected]>2013-11-28 12:26:37 +0330
committerIan Romanick <[email protected]>2014-01-29 09:11:39 -0700
commitf772d51c256b9e6458a4f9cf2021eadef34c8313 (patch)
tree1161c547874563f4348a2c160c3917f587e14148 /src
parent689b20cfe061215cf01705ed17ac50806458404b (diff)
mesa: Use _mesa_align_malloc in _mesa_buffer_data
v2: Fixed memory leak. Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/bufferobj.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index e305038bdbe..cde6ac2acaf 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -560,9 +560,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;