scandir() call requires free() of each returned dirent structure
and parent list. Code constructing HTML response of directory
listing is missing a call to free in some cases.
Signed-off-by: Andrej Krpic <ak77@tnode.com>
bool dir = !!(files[i]->d_type & DT_DIR);
if (name[0] == '.' && name[1] == 0)
- continue;
+ goto next;
sprintf(file, "%s", name);
if (stat(local_path, &s))
- continue;
+ goto next;
if (!dir) {
suffix = "";
}
if (!(s.st_mode & mode))
- continue;
+ goto next;
uh_chunk_printf(cl,
"<li><strong><a href='%s%s%s'>%s</a>%s"
type, s.st_size / 1024.0);
*file = 0;
+next:
free(files[i]);
}
}