Code Review
/
o-du
/
l2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
[ JIRA Id - ODUHIGH-606 ] Fixing null memory size allocation issue
[o-du/l2.git]
/
src
/
du_app
/
du_utils.h
diff --git
a/src/du_app/du_utils.h
b/src/du_app/du_utils.h
index
9c1cc14
..
98f0338
100644
(file)
--- a/
src/du_app/du_utils.h
+++ b/
src/du_app/du_utils.h
@@
-44,25
+44,35
@@
/* allocate and zero out a static buffer */
/* allocate and zero out a static buffer */
+#ifdef MEM_SIZE_CHECK
+#define DU_APP_MEMORY_ALLOC_SIZE_LOG(_line, _func, _size) \
+{\
+ DU_LOG("\n DUAPP line = %d, func = %s, _size= %d ", _line, _func, _size); \
+}
+#else
+#define DU_APP_MEMORY_ALLOC_SIZE_LOG(_line, _func, _size) {}
+#endif
+
+
#ifdef ODU_MEMORY_DEBUG_LOG
#define DU_MEM_LOG(_macro, _file, _line, _func, _size, _datPtr)\
{\
#ifdef ODU_MEMORY_DEBUG_LOG
#define DU_MEM_LOG(_macro, _file, _line, _func, _size, _datPtr)\
{\
- printf("\n%s=== %s +%d, %s, %lu, %p \n", \
+ printf("\n%s
,
=== %s +%d, %s, %lu, %p \n", \
_macro, _file, _line, _func, (uint64_t)_size, _datPtr); \
}
#else
_macro, _file, _line, _func, (uint64_t)_size, _datPtr); \
}
#else
-#define DU_MEM_LOG(_macro, _file, _line, _func, _size, _dataPtr) {\
-}
+#define DU_MEM_LOG(_macro, _file, _line, _func, _size, _dataPtr) {}
#endif
#define DU_ALLOC(_datPtr, _size) \
{ \
#endif
#define DU_ALLOC(_datPtr, _size) \
{ \
+ DU_APP_MEMORY_ALLOC_SIZE_LOG(__LINE__, __FUNCTION__, _size); \
int _ret; \
_ret = SGetSBuf(DU_APP_MEM_REGION, DU_POOL, \
(Data **)&_datPtr, _size); \
if(_ret == ROK) \
{\
int _ret; \
_ret = SGetSBuf(DU_APP_MEM_REGION, DU_POOL, \
(Data **)&_datPtr, _size); \
if(_ret == ROK) \
{\
- DU_MEM_LOG("DU
_
ALLOC", __FILE__, __LINE__, __FUNCTION__, _size, _datPtr);\
+ DU_MEM_LOG("DU
,
ALLOC", __FILE__, __LINE__, __FUNCTION__, _size, _datPtr);\
memset(_datPtr, 0, _size); \
}\
else \
memset(_datPtr, 0, _size); \
}\
else \
@@
-74,7
+84,7
@@
{ \
if(_datPtr != NULLP) \
{ \
{ \
if(_datPtr != NULLP) \
{ \
- DU_MEM_LOG("DU
_
FREE", __FILE__, __LINE__, __FUNCTION__, _size, _datPtr);\
+ DU_MEM_LOG("DU
,
FREE", __FILE__, __LINE__, __FUNCTION__, _size, _datPtr);\
SPutSBuf(DU_APP_MEM_REGION, DU_POOL, \
(Data *)_datPtr, _size); \
_datPtr = NULLP; \
SPutSBuf(DU_APP_MEM_REGION, DU_POOL, \
(Data *)_datPtr, _size); \
_datPtr = NULLP; \
@@
-84,10
+94,11
@@
* during inter-layer communication */
#define DU_ALLOC_SHRABL_BUF(_buf, _size) \
{ \
* during inter-layer communication */
#define DU_ALLOC_SHRABL_BUF(_buf, _size) \
{ \
+ DU_APP_MEMORY_ALLOC_SIZE_LOG(__LINE__, __FUNCTION__, _size); \
if(SGetStaticBuffer(DU_APP_MEM_REGION, DU_POOL, \
(Data **)&_buf, (Size) _size, 0) == ROK) \
{ \
if(SGetStaticBuffer(DU_APP_MEM_REGION, DU_POOL, \
(Data **)&_buf, (Size) _size, 0) == ROK) \
{ \
- DU_MEM_LOG("DU
_
ALLOC_SHRABL_BUF", __FILE__, __LINE__, __FUNCTION__, _size, _buf);\
+ DU_MEM_LOG("DU
,
ALLOC_SHRABL_BUF", __FILE__, __LINE__, __FUNCTION__, _size, _buf);\
memset((_buf), 0, _size); \
} \
else \
memset((_buf), 0, _size); \
} \
else \
@@
-101,7
+112,7
@@
{ \
if (_buf != NULLP) \
{ \
{ \
if (_buf != NULLP) \
{ \
- DU_MEM_LOG("DU
_
FREE_SHRABL_BUF", __FILE__, __LINE__, __FUNCTION__, _size, _buf);\
+ DU_MEM_LOG("DU
,
FREE_SHRABL_BUF", __FILE__, __LINE__, __FUNCTION__, _size, _buf);\
(Void) SPutStaticBuffer(_region, _pool, \
(Data *) _buf, (Size) _size, 0); \
_buf = NULLP; \
(Void) SPutStaticBuffer(_region, _pool, \
(Data *) _buf, (Size) _size, 0); \
_buf = NULLP; \