summaryrefslogtreecommitdiff
path: root/src/lib/dlt_user.c
diff options
context:
space:
mode:
authorStefan Held <stefan_held@mentor.com>2015-06-16 15:45:50 +0200
committerAlexander Wenzel <Alexander.AW.Wenzel@bmw.de>2015-07-21 12:35:26 +0200
commit3501bb9e64094947f74689375ca46a45a7d6bb13 (patch)
tree3b70bd23f777de4e21fe91d7db45671297f71764 /src/lib/dlt_user.c
parent14e6338a010b5bf6b5d29cac2a9c436667fb6901 (diff)
downloadDLT-daemon-3501bb9e64094947f74689375ca46a45a7d6bb13.tar.gz
Rework of unit tests in gtest_dlt_user
Fix all nullpointer errors in dlt_user.c Signed-off-by: Stefan Held <stefan_held@mentor.com> Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
Diffstat (limited to 'src/lib/dlt_user.c')
-rw-r--r--src/lib/dlt_user.c32
1 files changed, 26 insertions, 6 deletions
diff --git a/src/lib/dlt_user.c b/src/lib/dlt_user.c
index 16e4456..1a8f274 100644
--- a/src/lib/dlt_user.c
+++ b/src/lib/dlt_user.c
@@ -279,12 +279,12 @@ int dlt_init(void)
pthread_cond_init(&mq_init_condition, NULL);
/* Start the segmented thread */
- if(pthread_create(&(dlt_user.dlt_segmented_nwt_handle), NULL,
- (void *)dlt_user_trace_network_segmented_thread, NULL))
- {
- dlt_log(LOG_CRIT, "Can't start segmented thread!\n");
- return -1;
- }
+ if(pthread_create(&(dlt_user.dlt_segmented_nwt_handle), NULL,
+ (void *)dlt_user_trace_network_segmented_thread, NULL))
+ {
+ dlt_log(LOG_CRIT, "Can't start segmented thread!\n");
+ return -1;
+ }
return 0;
}
@@ -739,6 +739,10 @@ int dlt_register_app(const char *appid, const char * description)
}
int dlt_register_context(DltContext *handle, const char *contextid, const char * description)
{
+ // check nullpointer
+ if(!handle)
+ return -1;
+
if (dlt_user_initialised==0)
{
if (dlt_init()<0)
@@ -774,6 +778,10 @@ int dlt_register_context_ll_ts(DltContext *handle, const char *contextid, const
DltContextData log;
uint32_t i;
+ //check nullpointer
+ if(!handle)
+ return -1;
+
if (dlt_user_initialised==0)
{
if (dlt_init()<0)
@@ -1031,6 +1039,10 @@ int dlt_unregister_context(DltContext *handle)
DltContextData log;
int ret;
+ // check nullpointer
+ if(!handle)
+ return -1;
+
if (dlt_user_initialised==0)
{
return -1;
@@ -1283,6 +1295,10 @@ inline int dlt_user_log_write_start(DltContext *handle, DltContextData *log,DltL
int dlt_user_log_write_start_id(DltContext *handle, DltContextData *log,DltLogLevelType loglevel, uint32_t messageid)
{
+ // check nullpointer
+ if(!handle)
+ return -1;
+
if(dlt_user_initialised==0)
{
if (dlt_init()<0)
@@ -1358,6 +1374,10 @@ int dlt_user_log_write_raw_formatted(DltContextData *log,void *data,uint16_t len
uint16_t arg_size;
uint32_t type_info;
+ // check nullpointer
+ if(!log || !data)
+ return -1;
+
if (log==0)
{
return -1;