Follow up for Bug 536352 (missing null check and memory leak in nsinstall.c) to fix orange

This commit is contained in:
Wolfgang Rosenauer 2010-01-18 12:38:17 +01:00
Родитель 4a85f25a4c
Коммит f72c8f6699
1 изменённых файлов: 7 добавлений и 1 удалений

Просмотреть файл

@ -258,10 +258,15 @@ copydir( char *from, char *to, mode_t mode, char *group, char *owner,
sprintf(destdir, "%s%s%s", to, _DIRECTORY_SEPARATOR, base);
if (mkdirs(destdir, mode) != 0) {
fail("cannot make directory %s\n", destdir);
free(destdir);
return;
}
dir = opendir(from);
if (!(dir = opendir(from))) {
fail("cannot open directory %s\n", from);
free(destdir);
return;
}
direntry = xmalloc((unsigned int)PATH_MAX);
destentry = xmalloc((unsigned int)PATH_MAX);
@ -280,6 +285,7 @@ copydir( char *from, char *to, mode_t mode, char *group, char *owner,
copyfile( direntry, destentry, mode, group, owner, dotimes, uid, gid );
}
free(destdir);
free(direntry);
free(destentry);
closedir(dir);