Commit ed1904a7 authored by Andrea Guzzo's avatar Andrea Guzzo

safety belt : scan_directory() can return without setting arr to a valid value

parent a66663f0
......@@ -3639,12 +3639,14 @@ static void send_directory_listing(struct connection *conn, const char *dir) {
sort_direction, sort_direction, sort_direction);
num_entries = scan_directory(conn, dir, &arr);
if (arr) {
qsort(arr, num_entries, sizeof(arr[0]), compare_dir_entries);
for (i = 0; i < num_entries; i++) {
print_dir_entry(&arr[i]);
NS_FREE(arr[i].file_name);
}
NS_FREE(arr);
}
write_terminating_chunk(conn);
close_local_endpoint(conn);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment