Index: uspace/lib/ext4/src/filesystem.c
===================================================================
--- uspace/lib/ext4/src/filesystem.c	(revision 21374e03107e5b1bc843b1d8e853a323ab9db107)
+++ uspace/lib/ext4/src/filesystem.c	(revision accdbd830beca44bcb50139f5c5e256cbe7afda9)
@@ -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;
 }
