aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSaurabh Bipin Chandra2013-09-12 11:08:38 -0500
committerSaurabh Bipin Chandra2013-09-13 07:12:30 -0500
commite0bba2c15bbce4921132e9774137068232619e40 (patch)
tree147e64214f318898fceeb43542505da34704b36c /libdce_linux.c
parent2cf98af97f1e826818dafdfe4139506bf4778751 (diff)
downloadrepo-libdce-e0bba2c15bbce4921132e9774137068232619e40.tar.gz
repo-libdce-e0bba2c15bbce4921132e9774137068232619e40.tar.xz
repo-libdce-e0bba2c15bbce4921132e9774137068232619e40.zip
[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 <a0131926@ti.com>
Diffstat (limited to 'libdce_linux.c')
-rw-r--r--libdce_linux.c10
1 files changed, 8 insertions, 2 deletions
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)
86 86
87 _ASSERT(num > 0, DCE_EINVALID_INPUT); 87 _ASSERT(num > 0, DCE_EINVALID_INPUT);
88 88
89 desc = memplugin_alloc(num * sizeof(MmRpc_BufDesc), 1, MEM_TILER_1D, 0, 0); 89 desc = malloc(num * sizeof(MmRpc_BufDesc));
90 _ASSERT(desc != NULL, DCE_EOUT_OF_MEMORY); 90 _ASSERT(desc != NULL, DCE_EOUT_OF_MEMORY);
91 91
92 for( i = 0; i < num; i++ ) { 92 for( i = 0; i < num; i++ ) {
@@ -97,6 +97,9 @@ int dce_buf_lock(int num, size_t *handle)
97 97
98 _ASSERT(eError == DCE_EOK, DCE_EIPC_CALL_FAIL); 98 _ASSERT(eError == DCE_EOK, DCE_EIPC_CALL_FAIL);
99EXIT: 99EXIT:
100 if( desc ) {
101 free(desc);
102 }
100 return (eError); 103 return (eError);
101} 104}
102 105
@@ -108,7 +111,7 @@ int dce_buf_unlock(int num, size_t *handle)
108 111
109 _ASSERT(num > 0, DCE_EINVALID_INPUT); 112 _ASSERT(num > 0, DCE_EINVALID_INPUT);
110 113
111 desc = memplugin_alloc(num * sizeof(MmRpc_BufDesc), 1, MEM_TILER_1D, 0, 0); 114 desc = malloc(num * sizeof(MmRpc_BufDesc));
112 _ASSERT(desc != NULL, DCE_EOUT_OF_MEMORY); 115 _ASSERT(desc != NULL, DCE_EOUT_OF_MEMORY);
113 116
114 for( i = 0; i < num; i++ ) { 117 for( i = 0; i < num; i++ ) {
@@ -119,6 +122,9 @@ int dce_buf_unlock(int num, size_t *handle)
119 122
120 _ASSERT(eError == DCE_EOK, DCE_EIPC_CALL_FAIL); 123 _ASSERT(eError == DCE_EOK, DCE_EIPC_CALL_FAIL);
121EXIT: 124EXIT:
125 if( desc ) {
126 free(desc);
127 }
122 return (eError); 128 return (eError);
123} 129}
124 130