Index: uspace/srv/fs/fat/fat_fat.c
===================================================================
--- uspace/srv/fs/fat/fat_fat.c	(revision cca29e3c4af59e2c0dcd39ec5f532e5cc61145a2)
+++ uspace/srv/fs/fat/fat_fat.c	(revision 2f636b696bc3e13b7d55b312b309e8bb6dec217f)
@@ -379,4 +379,6 @@
 	for (b = 0, cl = 0; b < sf; b++) {
 		rc = block_get(&blk, dev_handle, rscnt + b, BLOCK_FLAGS_NONE);
+		if (rc != EOK)
+			goto error;
 		for (c = 0; c < bps / sizeof(fat_cluster_t); c++, cl++) {
 			fat_cluster_t *clst = (fat_cluster_t *)blk->data + c;
@@ -394,9 +396,11 @@
 					/* we are almost done */
 					rc = block_put(blk);
-					assert(rc == EOK);
+					if (rc != EOK)
+						goto error;
 					/* update the shadow copies of FAT */
 					rc = fat_alloc_shadow_clusters(bs,
 					    dev_handle, lifo, nclsts);
-					assert(rc == EOK);
+					if (rc != EOK)
+						goto error;
 					*mcl = lifo[found - 1];
 					*lcl = lifo[0];
@@ -408,5 +412,10 @@
 		}
 		rc = block_put(blk);
-		assert(rc == EOK);
+		if (rc != EOK) {
+error:
+			fibril_mutex_unlock(&fat_alloc_lock);
+			free(lifo);
+			return rc;
+		}
 	}
 	fibril_mutex_unlock(&fat_alloc_lock);
