Close opened directory on further allocation error

This commit is contained in:
Pierre Pronchery 2004-09-13 12:13:30 +00:00
parent b8dc227a6d
commit 68ace1b9d5

View File

@ -92,7 +92,10 @@ static int _chgrp_do_recursive_do(int opts, gid_t gid, char * file)
len = strlen(file);
len += (len && file[len-1] == '/') ? 1 : 2;
if((s = malloc(len)) == NULL)
{
closedir(dir);
return _chgrp_error(file, 1);
}
strcpy(s, file);
s[len-2] = '/';
s[len-1] = '\0';