Index: uspace/lib/ext4/src/filesystem.c
===================================================================
--- uspace/lib/ext4/src/filesystem.c	(revision 6ea5e7a007c27f115240f1c9d0b284b05315abca)
+++ uspace/lib/ext4/src/filesystem.c	(revision ca645a25041e245f85f0c75c5695e8546fb409f1)
@@ -421,4 +421,5 @@
     enum cache_mode cmode, aoff64_t *size, ext4_filesystem_t **rfs)
 {
+	int fs_inited = 0;
 	ext4_filesystem_t *fs = NULL;
 	fs_node_t *root_node = NULL;
@@ -437,4 +438,6 @@
 	if (rc != EOK)
 		goto error;
+
+	fs_inited = 1;
 
 	/* Read root node */
@@ -463,9 +466,7 @@
 		ext4_node_put(root_node);
 
-	if (fs != NULL) {
+	if (fs_inited)
 		ext4_filesystem_fini(fs);
-		free(fs);
-	}
-
+	free(fs);
 	return rc;
 }
