summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngela Stegmaier <angelabaker@ti.com>2017-01-18 14:01:13 -0600
committerAngela Stegmaier <angelabaker@ti.com>2017-01-30 22:32:38 -0600
commit9dd159d851496047b6833a5b7c71ed9ea95efc07 (patch)
tree0953702ccf8f3dc35c1c0e479845c185185ff3e8
parenteb8cff25b81bbbe1df01059345dea4054a2a2a64 (diff)
downloadipc-3.45.tar.gz
Linux: Fix Static Analysis Reported Issues in IPC3.45.00.00_eng3.45.00.003.45
This patch addresses the following static analysis reported issues: In linux/src/api/gates/GateMP.c: Possible Null Pointer Dereference in GateMP_Instance_finalize In linux/src/api/gates/GateMutex.c: Possible Null Pointer Dereference in GateMutex_delete In linux/src/api/MessageQ.c: Uninitialized Variable in MessageQ_free Signed-off-by: Angela Stegmaier <angelabaker@ti.com>
-rw-r--r--linux/src/api/MessageQ.c3
-rw-r--r--linux/src/api/gates/GateMP.c2
-rw-r--r--linux/src/api/gates/GateMutex.c4
3 files changed, 5 insertions, 4 deletions
diff --git a/linux/src/api/MessageQ.c b/linux/src/api/MessageQ.c
index db96b24..945712e 100644
--- a/linux/src/api/MessageQ.c
+++ b/linux/src/api/MessageQ.c
@@ -1157,10 +1157,9 @@ Int MessageQ_free(MessageQ_Msg msg)
}
else {
heap = (IHeap_Handle)MessageQ_module->heaps[msg->heapId];
+ IHeap_free(heap, (void *)msg);
}
- IHeap_free(heap, (void *)msg);
-
return (status);
}
diff --git a/linux/src/api/gates/GateMP.c b/linux/src/api/gates/GateMP.c
index 9a0024f..4aaadbd 100644
--- a/linux/src/api/gates/GateMP.c
+++ b/linux/src/api/gates/GateMP.c
@@ -904,7 +904,7 @@ static Void GateMP_Instance_finalize(GateMP_Object *obj, Int status)
/* TODO: close/delete local gate */
/* clear the handle array entry in local memory */
- if (obj->resourceId != (UInt)-1) {
+ if (remoteGates && (obj->resourceId != (UInt)-1)) {
remoteGates[obj->resourceId] = NULL;
}
diff --git a/linux/src/api/gates/GateMutex.c b/linux/src/api/gates/GateMutex.c
index 6cdd10a..bb5f21c 100644
--- a/linux/src/api/gates/GateMutex.c
+++ b/linux/src/api/gates/GateMutex.c
@@ -102,7 +102,7 @@ GateMutex_Handle GateMutex_create(const GateMutex_Params * params,
Int GateMutex_delete(GateMutex_Handle * handle)
{
- GateMutex_Object * obj = (GateMutex_Object *)*handle;
+ GateMutex_Object * obj = NULL;
if (handle == NULL) {
return GateMutex_E_INVALIDARG;
@@ -110,6 +110,8 @@ Int GateMutex_delete(GateMutex_Handle * handle)
if (*handle == NULL) {
return GateMutex_E_INVALIDARG;
}
+
+ obj = (GateMutex_Object *)*handle;
pthread_mutex_destroy(&(obj->mutex));
free(*handle);
*handle = NULL;