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:
aurel 2005-07-22 22:52:13 +00:00
parent 2affcd2e61
commit e190bcd2bb
2 changed files with 5 additions and 1 deletions

View File

@ -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) {

View File

@ -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]);