mirror of
https://github.com/emikulic/darkhttpd.git
synced 2023-08-10 21:13:08 +03:00
Don't qsort() NULL.
Found by: clang static analyzer
This commit is contained in:
parent
1b7bbcc033
commit
ccbe7cffa7
@ -1512,7 +1512,9 @@ static ssize_t make_sorted_dirlist(const char *path, struct dlent ***output) {
|
||||
}
|
||||
closedir(dir);
|
||||
free(currname);
|
||||
qsort(list, entries, sizeof(struct dlent*), dlent_cmp);
|
||||
assert(list != NULL);
|
||||
if (list) /* there's gotta be at least ".." */
|
||||
qsort(list, entries, sizeof(struct dlent*), dlent_cmp);
|
||||
*output = xrealloc(list, sizeof(struct dlent*) * entries);
|
||||
return (ssize_t)entries;
|
||||
#undef POOL_INCR
|
||||
|
Loading…
Reference in New Issue
Block a user