diff --git a/cfg/posix.cfg b/cfg/posix.cfg
index c45217e3b..ed5a9a273 100644
--- a/cfg/posix.cfg
+++ b/cfg/posix.cfg
@@ -2928,6 +2928,56 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s
+
+
+ false
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+
+
+
+
+
+ false
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+
+
+
+
diff --git a/test/cfg/posix.c b/test/cfg/posix.c
index 8a04de4ed..265c413e9 100644
--- a/test/cfg/posix.c
+++ b/test/cfg/posix.c
@@ -18,6 +18,7 @@
#include
#include
#include
+#include
void bufferAccessOutOfBounds(int fd)
{
@@ -54,7 +55,7 @@ void bufferAccessOutOfBounds(int fd)
gethostname(a, 6);
}
-void nullPointer(char *p, int fd)
+void nullPointer(char *p, int fd, pthread_mutex_t mutex)
{
// cppcheck-suppress ignoredReturnValue
isatty(0);
@@ -88,6 +89,19 @@ void nullPointer(char *p, int fd)
// cppcheck-suppress strtokCalled
// cppcheck-suppress nullPointer
strtok(p, NULL);
+
+ // cppcheck-suppress nullPointer
+ pthread_mutex_init(NULL, NULL);
+ // Second argument can be NULL
+ pthread_mutex_init(&mutex, NULL);
+ // cppcheck-suppress nullPointer
+ pthread_mutex_destroy(NULL);
+ // cppcheck-suppress nullPointer
+ pthread_mutex_lock(NULL);
+ // cppcheck-suppress nullPointer
+ pthread_mutex_trylock(NULL);
+ // cppcheck-suppress nullPointer
+ pthread_mutex_unlock(NULL);
}
void memleak_getaddrinfo()
@@ -207,6 +221,7 @@ void uninitvar(int fd)
int decimal, sign;
double d;
void *p;
+ pthread_mutex_t mutex;
// cppcheck-suppress uninitvar
write(x,"ab",2);
// TODO cppcheck-suppress uninitvar
@@ -259,6 +274,18 @@ void uninitvar(int fd)
// cppcheck-suppress strtokCalled
// cppcheck-suppress uninitvar
strtok(strtok_arg1, ";");
+
+ // cppcheck-suppress uninitvar
+ pthread_mutex_lock(&mutex);
+ // cppcheck-suppress uninitvar
+ pthread_mutex_trylock(&mutex);
+ // cppcheck-suppress uninitvar
+ pthread_mutex_unlock(&mutex);
+ // after initialization it must be OK to call lock, trylock and unlock for this mutex
+ pthread_mutex_init(&mutex, NULL);
+ pthread_mutex_lock(&mutex);
+ pthread_mutex_trylock(&mutex);
+ pthread_mutex_unlock(&mutex);
}
void uninitvar_getcwd(void)