diff options
author | Elliott Hughes <enh@google.com> | 2013-09-18 16:36:33 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-09-18 16:36:33 -0700 |
commit | c67bd8d7cd9b43a5a5ef249ea787ac9786359d22 (patch) | |
tree | e8c46b565cfd38a5934164eabeffd822612ec8f7 | |
parent | c4295d9b72812afbaebd7f2512c7a5bba9e7d5fa (diff) | |
parent | a208ea6301b3a7141f800d21407b0befa8ad0a56 (diff) | |
download | system_core-c67bd8d7cd9b43a5a5ef249ea787ac9786359d22.zip system_core-c67bd8d7cd9b43a5a5ef249ea787ac9786359d22.tar.gz system_core-c67bd8d7cd9b43a5a5ef249ea787ac9786359d22.tar.bz2 |
am a208ea63: Merge "Fix fstab memory leak"
* commit 'a208ea6301b3a7141f800d21407b0befa8ad0a56':
Fix fstab memory leak
-rw-r--r-- | fs_mgr/fs_mgr.c | 6 |
1 files changed, 4 insertions, 2 deletions
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 @@ struct fstab *fs_mgr_read_fstab(const char *fstab_path) 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 @@ struct fstab *fs_mgr_read_fstab(const char *fstab_path) return fstab; err: + fclose(fstab_file); free(line); + if (fstab) + fs_mgr_free_fstab(fstab); return NULL; } @@ -361,7 +364,6 @@ void fs_mgr_free_fstab(struct fstab *fstab) 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) */ |