Fix some error handling cases.
This commit is contained in:
parent
5cd8daf798
commit
1e44adf395
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: rumpfiber.c,v 1.5 2014/11/05 01:39:40 pooka Exp $ */
|
/* $NetBSD: rumpfiber.c,v 1.6 2014/11/08 21:27:04 justin Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007-2013 Antti Kantee. All Rights Reserved.
|
* Copyright (c) 2007-2013 Antti Kantee. All Rights Reserved.
|
||||||
@ -68,7 +68,7 @@
|
|||||||
#include "rumpuser_port.h"
|
#include "rumpuser_port.h"
|
||||||
|
|
||||||
#if !defined(lint)
|
#if !defined(lint)
|
||||||
__RCSID("$NetBSD: rumpfiber.c,v 1.5 2014/11/05 01:39:40 pooka Exp $");
|
__RCSID("$NetBSD: rumpfiber.c,v 1.6 2014/11/08 21:27:04 justin Exp $");
|
||||||
#endif /* !lint */
|
#endif /* !lint */
|
||||||
|
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
@ -199,11 +199,16 @@ create_thread(const char *name, void *cookie, void (*f)(void *), void *data,
|
|||||||
{
|
{
|
||||||
struct thread *thread = calloc(1, sizeof(struct thread));
|
struct thread *thread = calloc(1, sizeof(struct thread));
|
||||||
|
|
||||||
|
if (!thread) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (!stack) {
|
if (!stack) {
|
||||||
assert(stack_size == 0);
|
assert(stack_size == 0);
|
||||||
stack = mmap(NULL, STACKSIZE, PROT_READ | PROT_WRITE,
|
stack = mmap(NULL, STACKSIZE, PROT_READ | PROT_WRITE,
|
||||||
MAP_SHARED | MAP_ANON, -1, 0);
|
MAP_SHARED | MAP_ANON, -1, 0);
|
||||||
if (stack == MAP_FAILED) {
|
if (stack == MAP_FAILED) {
|
||||||
|
free(thread);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
stack_size = STACKSIZE;
|
stack_size = STACKSIZE;
|
||||||
|
Loading…
Reference in New Issue
Block a user