summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFalk Tristram <falk.tristram@cognex.com>2017-05-26 10:23:54 -0500
committerAngela Stegmaier <angelabaker@ti.com>2017-05-26 15:42:03 -0500
commit7b3a739876e46d3194861a2d93077ff95954affb (patch)
treec54858167ae980b9a575e1bac60a427457a90f48
parent3f171ca6ca04f950e60d7521e20e2a20a3f69b8b (diff)
downloadipc-7b3a739876e46d3194861a2d93077ff95954affb.tar.gz
Linux: NameServer_daemon: Initialize mutex_attr before using it3.46.01.03_eng3.46.01.03
Initialize mutex_attr before using it. Otherwise, it could contain some uninitialized values. Also, initialize nsMsg to zero before using it. Signed-off-by: Falk Tristram <falk.tristram@cognex.com> Signed-off-by: Angela Stegmaier <angelabaker@ti.com>
-rw-r--r--linux/src/daemon/NameServer_daemon.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/linux/src/daemon/NameServer_daemon.c b/linux/src/daemon/NameServer_daemon.c
index c1a58f0..f7982c7 100644
--- a/linux/src/daemon/NameServer_daemon.c
+++ b/linux/src/daemon/NameServer_daemon.c
@@ -680,6 +680,7 @@ NameServer_Handle NameServer_create(String name,
{
NameServer_Handle handle = NULL;
pthread_mutexattr_t mutex_attr;
+ Int status = 0;
assert(params != NULL);
assert(name != NULL);
@@ -689,6 +690,9 @@ NameServer_Handle NameServer_create(String name,
pthread_mutex_lock(&NameServer_module->modGate);
+ status = pthread_mutexattr_init(&mutex_attr);
+ assert(status == 0);
+
/* check if the name is already created or not */
handle = NameServer_getHandle(name);
if (handle != NULL) {
@@ -748,6 +752,7 @@ cleanup:
handle = NULL;
leave:
+ pthread_mutexattr_destroy(&mutex_attr);
pthread_mutex_unlock(&NameServer_module->modGate);
return (handle);
@@ -1074,6 +1079,7 @@ Int NameServer_getRemote(NameServer_Handle handle,
LOG1("NameServer_getRemote: Sending request via sock: %d\n", sock)
+ memset(&nsMsg, 0, sizeof(NameServerRemote_Msg));
/* Create request message and send to remote processor: */
nsMsg.reserved = NAMESERVER_MSG_TOKEN;
nsMsg.request = NAMESERVER_REQUEST;