mirror of https://github.com/vitalif/e2fsprogs
[COVERITY] Fix memory leak in profile library
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>bitmap-optimize
parent
b772900b4b
commit
93503267c9
|
@ -1,3 +1,8 @@
|
||||||
|
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>
|
2007-03-19 Theodore Tso <tytso@mit.edu>
|
||||||
|
|
||||||
* pass3.c (check_directory): Add error check in case
|
* pass3.c (check_directory): Add error check in case
|
||||||
|
|
|
@ -417,8 +417,10 @@ errcode_t profile_open_file(const char * filespec,
|
||||||
len += strlen(home_env);
|
len += strlen(home_env);
|
||||||
}
|
}
|
||||||
expanded_filename = malloc(len);
|
expanded_filename = malloc(len);
|
||||||
if (expanded_filename == 0)
|
if (expanded_filename == 0) {
|
||||||
|
profile_free_file(prf);
|
||||||
return errno;
|
return errno;
|
||||||
|
}
|
||||||
if (home_env) {
|
if (home_env) {
|
||||||
strcpy(expanded_filename, home_env);
|
strcpy(expanded_filename, home_env);
|
||||||
strcat(expanded_filename, filespec+1);
|
strcat(expanded_filename, filespec+1);
|
||||||
|
|
Loading…
Reference in New Issue