mirror of
https://github.com/sigmasternchen/CFloor
synced 2025-03-15 12:28:53 +00:00
fixed empty diretory bug
This commit is contained in:
parent
fe3d0871ec
commit
9d9aa7fd10
1 changed files with 3 additions and 1 deletions
|
@ -35,6 +35,9 @@ int scandirSort(const struct dirent** a, const struct dirent** b) {
|
|||
}
|
||||
|
||||
void freeDirent(struct dirent** list, int number) {
|
||||
if (list == NULL || number == 0)
|
||||
return;
|
||||
|
||||
for(int i = 0; i < number; i++) {
|
||||
free(list[i]);
|
||||
}
|
||||
|
@ -88,7 +91,6 @@ int showIndex(int fd, const char* path, const char* documentRoot) {
|
|||
fprintf(stream, " </body>\n");
|
||||
fprintf(stream, "</html>\n");
|
||||
|
||||
free(list);
|
||||
fclose(stream);
|
||||
|
||||
freeDirent(list, number);
|
||||
|
|
Loading…
Reference in a new issue