mirror of
https://github.com/ep00ch/lwip-contrib-mac.git
synced 2024-08-27 11:29:21 +00:00
Fixed missing malloc return value checks.
This commit is contained in:
parent
8facfb725a
commit
14ec6680d2
@ -110,7 +110,7 @@ introduce_thread(pthread_t id)
|
||||
|
||||
thread = malloc(sizeof(struct sys_thread));
|
||||
|
||||
if (thread) {
|
||||
if (thread != NULL) {
|
||||
pthread_mutex_lock(&threads_mutex);
|
||||
thread->next = threads;
|
||||
thread->timeouts.next = NULL;
|
||||
@ -181,6 +181,7 @@ sys_mbox_new()
|
||||
struct sys_mbox *mbox;
|
||||
|
||||
mbox = malloc(sizeof(struct sys_mbox));
|
||||
if (mbox != NULL) {
|
||||
mbox->first = mbox->last = 0;
|
||||
mbox->mail = sys_sem_new_(0);
|
||||
mbox->mutex = sys_sem_new_(1);
|
||||
@ -192,7 +193,7 @@ sys_mbox_new()
|
||||
lwip_stats.sys.mbox.max = lwip_stats.sys.mbox.used;
|
||||
}
|
||||
#endif /* SYS_STATS */
|
||||
|
||||
}
|
||||
return mbox;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
@ -313,11 +314,11 @@ sys_sem_new_(u8_t count)
|
||||
struct sys_sem *sem;
|
||||
|
||||
sem = malloc(sizeof(struct sys_sem));
|
||||
if (sem != NULL) {
|
||||
sem->c = count;
|
||||
|
||||
pthread_cond_init(&(sem->cond), NULL);
|
||||
pthread_mutex_init(&(sem->mutex), NULL);
|
||||
|
||||
}
|
||||
return sem;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user