Merge "Fix fstab memory leak"
diff --git a/fs_mgr/fs_mgr.c b/fs_mgr/fs_mgr.c
index 85ce397..4f11fbb 100644
--- a/fs_mgr/fs_mgr.c
+++ b/fs_mgr/fs_mgr.c
@@ -222,7 +222,7 @@
     char *line = NULL;
     const char *delim = " \t";
     char *save_ptr, *p;
-    struct fstab *fstab;
+    struct fstab *fstab = NULL;
     struct fstab_rec *recs;
     char *key_loc;
     long long part_length;
@@ -345,7 +345,10 @@
     return fstab;
 
 err:
+    fclose(fstab_file);
     free(line);
+    if (fstab)
+        fs_mgr_free_fstab(fstab);
     return NULL;
 }
 
@@ -361,7 +364,6 @@
         free(fstab->recs[i].fs_options);
         free(fstab->recs[i].key_loc);
         free(fstab->recs[i].label);
-        i++;
     }
 
     /* Free the fstab_recs array created by calloc(3) */