@@ -931,7 +931,7 @@ DltDaemonContext *dlt_daemon_context_add(DltDaemon *daemon,
931931 return (DltDaemonContext * )NULL ;
932932
933933 if (user_list -> contexts == NULL ) {
934- user_list -> contexts = (DltDaemonContext * )malloc ( sizeof (DltDaemonContext ) * DLT_DAEMON_CONTEXT_ALLOC_SIZE );
934+ user_list -> contexts = (DltDaemonContext * )calloc ( 1 , sizeof (DltDaemonContext ) * DLT_DAEMON_CONTEXT_ALLOC_SIZE );
935935
936936 if (user_list -> contexts == NULL )
937937 return (DltDaemonContext * )NULL ;
@@ -953,7 +953,7 @@ DltDaemonContext *dlt_daemon_context_add(DltDaemon *daemon,
953953 if ((user_list -> num_contexts % DLT_DAEMON_CONTEXT_ALLOC_SIZE ) == 0 ) {
954954 /* allocate memory for context in steps of DLT_DAEMON_CONTEXT_ALLOC_SIZE, e.g 100 */
955955 old = user_list -> contexts ;
956- user_list -> contexts = (DltDaemonContext * )malloc ( (size_t ) sizeof (DltDaemonContext ) *
956+ user_list -> contexts = (DltDaemonContext * )calloc ( 1 , (size_t ) sizeof (DltDaemonContext ) *
957957 ((user_list -> num_contexts /
958958 DLT_DAEMON_CONTEXT_ALLOC_SIZE ) + 1 ) *
959959 DLT_DAEMON_CONTEXT_ALLOC_SIZE );
@@ -1635,15 +1635,21 @@ void dlt_daemon_control_reset_to_factory_default(DltDaemon *daemon,
16351635 if (fd != NULL ) {
16361636 /* Close and delete file */
16371637 fclose (fd );
1638- unlink (filename );
1638+ if (unlink (filename ) != 0 ) {
1639+ dlt_vlog (LOG_WARNING , "%s: unlink() failed: %s\n" ,
1640+ __func__ , strerror (errno ));
1641+ }
16391642 }
16401643
16411644 fd = fopen (filename1 , "r" );
16421645
16431646 if (fd != NULL ) {
16441647 /* Close and delete file */
16451648 fclose (fd );
1646- unlink (filename1 );
1649+ if (unlink (filename1 ) != 0 ) {
1650+ dlt_vlog (LOG_WARNING , "%s: unlink() failed: %s\n" ,
1651+ __func__ , strerror (errno ));
1652+ }
16471653 }
16481654
16491655 daemon -> default_log_level = (int8_t ) InitialContextLogLevel ;
0 commit comments