1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-22 17:39:53 +03:00

Merge pull request #1749 from chipitsine/master

src/Mayaqua/Unix.c: improve memory allocation handling according to Coverity
This commit is contained in:
Ilya Shipitsin 2023-01-15 22:09:00 +06:00 committed by GitHub
commit 8362637353
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1869,11 +1869,16 @@ LOCK *UnixNewLock()
pthread_mutex_t *mutex;
// Memory allocation
LOCK *lock = UnixMemoryAlloc(sizeof(LOCK));
if (lock == NULL)
{
return NULL;
}
// Create a mutex
mutex = UnixMemoryAlloc(sizeof(pthread_mutex_t));
if (mutex == NULL)
{
UnixMemoryFree(lock);
return NULL;
}