[libbarrelfish] Properly check for error in case slab_alloc fails.
authorSimon Gerber <simon.gerber@inf.ethz.ch>
Tue, 11 Oct 2016 15:24:44 +0000 (17:24 +0200)
committerSimon Gerber <simon.gerber@inf.ethz.ch>
Tue, 11 Oct 2016 15:25:16 +0000 (17:25 +0200)
Reported-by: Andreas Furrer <anfurrer@student.ethz.ch>
Signed-off-by: Andreas Furrer <anfurrer@student.ethz.ch>
Signed-off-by: Simon Gerber <simon.gerber@inf.ethz.ch>

lib/barrelfish/slot_alloc/twolevel_slot_alloc.c

index 208570b..69d8394 100644 (file)
@@ -108,7 +108,7 @@ errval_t two_level_alloc(struct slot_allocator *ca, struct capref *ret)
 
             // Try allocating again
             buf = slab_alloc(&mca->slab);
-            if (err_is_fail(err)) {
+            if (!buf) {
                 thread_mutex_unlock(&ca->mutex);
                 return err_push(err, LIB_ERR_SLAB_ALLOC_FAIL);
             }