am c67bd8d7: am a208ea63: Merge "Fix fstab memory leak"

* commit 'c67bd8d7cd9b43a5a5ef249ea787ac9786359d22':
  Fix fstab memory leak
This commit is contained in:
Elliott Hughes 2013-09-18 16:38:14 -07:00 committed by Android Git Automerger
commit a2a93250f6
1 changed files with 4 additions and 2 deletions

View File

@ -244,7 +244,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;
struct fs_mgr_flag_values flag_vals;
#define FS_OPTIONS_LEN 1024
@ -363,7 +363,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;
}
@ -379,7 +382,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) */