mirror of https://github.com/vitalif/e2fsprogs
finddev.c (scan_dir): Fix memory leak; we weren't calling
closedir() when exiting the function in all cases.bitmap-optimize
parent
1e16526bd9
commit
3751721fbb
|
@ -1,3 +1,8 @@
|
|||
2001-07-29 Theodore Tso <tytso@valinux.com>
|
||||
|
||||
* finddev.c (scan_dir): Fix memory leak; we weren't calling
|
||||
closedir() when exiting the function in all cases.
|
||||
|
||||
2001-07-27 Theodore Tso <tytso@valinux.com>
|
||||
|
||||
* mkjournal.c (ext2fs_create_journal_superblock): Set the first
|
||||
|
|
|
@ -101,15 +101,18 @@ static int scan_dir(char *dirname, dev_t device, struct dir_list **list,
|
|||
add_to_dirlist(path, list);
|
||||
if (S_ISBLK(st.st_mode) && st.st_rdev == device) {
|
||||
cp = malloc(strlen(path)+1);
|
||||
if (!cp)
|
||||
if (!cp) {
|
||||
closedir(dir);
|
||||
return ENOMEM;
|
||||
}
|
||||
strcpy(cp, path);
|
||||
*ret_path = cp;
|
||||
return 0;
|
||||
goto success;
|
||||
}
|
||||
skip_to_next:
|
||||
dp = readdir(dir);
|
||||
}
|
||||
success:
|
||||
closedir(dir);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue