From e0bba2c15bbce4921132e9774137068232619e40 Mon Sep 17 00:00:00 2001 From: Saurabh Bipin Chandra Date: Thu, 12 Sep 2013 21:38:38 +0530 Subject: [LINUX] Fix for memory allocation/free in buf_lock/unlock This patch makes the following changes within dce_buf_lock/unlock: 1. Changes API of memory allocation from memplugin_alloc to malloc as Tiler/Shared memory is not needed 2. Frees the allocated memory at EXIT from function. Change-Id: Id728abad86d4582f0e904f4c8680e99d47cb3a0a Signed-off-by: Saurabh Bipin Chandra --- libdce_linux.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'libdce_linux.c') diff --git a/libdce_linux.c b/libdce_linux.c index 3de9b15..5b79e69 100644 --- a/libdce_linux.c +++ b/libdce_linux.c @@ -86,7 +86,7 @@ int dce_buf_lock(int num, size_t *handle) _ASSERT(num > 0, DCE_EINVALID_INPUT); - desc = memplugin_alloc(num * sizeof(MmRpc_BufDesc), 1, MEM_TILER_1D, 0, 0); + desc = malloc(num * sizeof(MmRpc_BufDesc)); _ASSERT(desc != NULL, DCE_EOUT_OF_MEMORY); for( i = 0; i < num; i++ ) { @@ -97,6 +97,9 @@ int dce_buf_lock(int num, size_t *handle) _ASSERT(eError == DCE_EOK, DCE_EIPC_CALL_FAIL); EXIT: + if( desc ) { + free(desc); + } return (eError); } @@ -108,7 +111,7 @@ int dce_buf_unlock(int num, size_t *handle) _ASSERT(num > 0, DCE_EINVALID_INPUT); - desc = memplugin_alloc(num * sizeof(MmRpc_BufDesc), 1, MEM_TILER_1D, 0, 0); + desc = malloc(num * sizeof(MmRpc_BufDesc)); _ASSERT(desc != NULL, DCE_EOUT_OF_MEMORY); for( i = 0; i < num; i++ ) { @@ -119,6 +122,9 @@ int dce_buf_unlock(int num, size_t *handle) _ASSERT(eError == DCE_EOK, DCE_EIPC_CALL_FAIL); EXIT: + if( desc ) { + free(desc); + } return (eError); } -- cgit v1.2.3-54-g00ecf