xbps_remove_binary_pkg_meta(): fix a memleak if opendir(2) fails.

--HG--
extra : convert_revision : e5a107219e809abf4a8f5fac8e066016b1d46455
This commit is contained in:
Juan RP 2009-04-05 12:47:02 +02:00
parent 500cfe4b4f
commit 4f8d329867
1 changed files with 3 additions and 1 deletions

View File

@ -81,8 +81,10 @@ xbps_remove_binary_pkg_meta(const char *pkgname)
return errno;
dirp = opendir(metadir);
if (dirp == NULL)
if (dirp == NULL) {
free(metadir);
return errno;
}
while ((dp = readdir(dirp)) != NULL) {
if ((strcmp(dp->d_name, ".") == 0) ||