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:
@@ -1512,7 +1512,9 @@ static ssize_t make_sorted_dirlist(const char *path, struct dlent ***output) {
|
|||||||
}
|
}
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
free(currname);
|
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);
|
*output = xrealloc(list, sizeof(struct dlent*) * entries);
|
||||||
return (ssize_t)entries;
|
return (ssize_t)entries;
|
||||||
#undef POOL_INCR
|
#undef POOL_INCR
|
||||||
|
Reference in New Issue
Block a user