mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2024-11-23 01:49: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:
commit
8362637353
@ -1869,11 +1869,16 @@ LOCK *UnixNewLock()
|
|||||||
pthread_mutex_t *mutex;
|
pthread_mutex_t *mutex;
|
||||||
// Memory allocation
|
// Memory allocation
|
||||||
LOCK *lock = UnixMemoryAlloc(sizeof(LOCK));
|
LOCK *lock = UnixMemoryAlloc(sizeof(LOCK));
|
||||||
|
if (lock == NULL)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
// Create a mutex
|
// Create a mutex
|
||||||
mutex = UnixMemoryAlloc(sizeof(pthread_mutex_t));
|
mutex = UnixMemoryAlloc(sizeof(pthread_mutex_t));
|
||||||
if (mutex == NULL)
|
if (mutex == NULL)
|
||||||
{
|
{
|
||||||
|
UnixMemoryFree(lock);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user