Mercurial > mplayer.hg
changeset 16061:261022c048cd
add some closedir() to fix some opendir() leaks
author | aurel |
---|---|
date | Fri, 22 Jul 2005 22:52:13 +0000 |
parents | f3a003167683 |
children | 09ecc9c9df3b |
files | libmenu/menu_filesel.c osdep/scandir.c |
diffstat | 2 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libmenu/menu_filesel.c Fri Jul 22 21:27:54 2005 +0000 +++ b/libmenu/menu_filesel.c Fri Jul 22 22:52:13 2005 +0000 @@ -177,6 +177,8 @@ } bailout: + closedir(dirp); + qsort(namelist, n, sizeof(char *), (kill_warn)compare); if (n < 0) {
--- a/osdep/scandir.c Fri Jul 22 21:27:54 2005 +0000 +++ b/osdep/scandir.c Fri Jul 22 22:52:13 2005 +0000 @@ -87,7 +87,7 @@ /* 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 @@ error: + closedir(dir); + if (namelist) { for (i = 0; i < used; i++) free(namelist[i]);