The profile must be freed early if the subsequent memory allocation
fails for 'expanded_filename'.
Coverity ID: 14: Resource Leak
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
+2007-03-21 Theodore Tso <tytso@mit.edu>
+
+ * profile.c (profile_open_file): Fix memory leak if malloc() fails
+ while setting up the profile data structure.
+
2007-03-19 Theodore Tso <tytso@mit.edu>
* pass3.c (check_directory): Add error check in case
len += strlen(home_env);
}
expanded_filename = malloc(len);
- if (expanded_filename == 0)
+ if (expanded_filename == 0) {
+ profile_free_file(prf);
return errno;
+ }
if (home_env) {
strcpy(expanded_filename, home_env);
strcat(expanded_filename, filespec+1);