Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/librumpuser Fix some error handling cases.



details:   https://anonhg.NetBSD.org/src/rev/3a706df67092
branches:  trunk
changeset: 333561:3a706df67092
user:      justin <justin%NetBSD.org@localhost>
date:      Sat Nov 08 21:27:04 2014 +0000

description:
Fix some error handling cases.

diffstat:

 lib/librumpuser/rumpfiber.c |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (35 lines):

diff -r ee22c76ec3d9 -r 3a706df67092 lib/librumpuser/rumpfiber.c
--- a/lib/librumpuser/rumpfiber.c       Sat Nov 08 19:27:40 2014 +0000
+++ b/lib/librumpuser/rumpfiber.c       Sat Nov 08 21:27:04 2014 +0000
@@ -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.
@@ -68,7 +68,7 @@
 #include "rumpuser_port.h"
 
 #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 */
 
 #include <sys/ioctl.h>
@@ -199,11 +199,16 @@
 {
        struct thread *thread = calloc(1, sizeof(struct thread));
 
+       if (!thread) {
+               return NULL;
+       }
+
        if (!stack) {
                assert(stack_size == 0);
                stack = mmap(NULL, STACKSIZE, PROT_READ | PROT_WRITE,
                    MAP_SHARED | MAP_ANON, -1, 0);
                if (stack == MAP_FAILED) {
+                       free(thread);
                        return NULL;
                }
                stack_size = STACKSIZE;



Home | Main Index | Thread Index | Old Index