util/llsort: Prevent NULL pointer dereference

If `_tail` is not assigned, we cannot assign `_tail->next`.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This commit is contained in:
Felix Walter 2023-06-05 13:58:08 +02:00
parent 1c11d4fa25
commit 2bb37f846e

View file

@ -121,7 +121,8 @@
* and q has too */ \
_p = _q; \
} \
_tail->next = NULL; \
if (_tail) \
_tail->next = NULL; \
/* If we have done only one merge, we're finished. */ \
if (_nmerges <= 1) { \
/* allow for nmerges == 0, the empty list case */ \