mirror of https://github.com/mpv-player/mpv
add some closedir() to fix some opendir() leaks
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@16062 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
2affcd2e61
commit
e190bcd2bb
|
@ -177,6 +177,8 @@ static int open_dir(menu_t* menu,char* args) {
|
|||
}
|
||||
|
||||
bailout:
|
||||
closedir(dirp);
|
||||
|
||||
qsort(namelist, n, sizeof(char *), (kill_warn)compare);
|
||||
|
||||
if (n < 0) {
|
||||
|
|
|
@ -87,7 +87,7 @@ scandir(const char *dirname,
|
|||
/* duplicate struct direct for this entry */
|
||||
len = offsetof(struct dirent, d_name) + strlen(ent->d_name) + 1;
|
||||
if ((ent2 = malloc(len)) == NULL)
|
||||
return -1;
|
||||
goto error;
|
||||
|
||||
if (used >= allocated) {
|
||||
allocated *= 2;
|
||||
|
@ -109,6 +109,8 @@ scandir(const char *dirname,
|
|||
|
||||
|
||||
error:
|
||||
closedir(dir);
|
||||
|
||||
if (namelist) {
|
||||
for (i = 0; i < used; i++)
|
||||
free(namelist[i]);
|
||||
|
|
Loading…
Reference in New Issue