mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
Coverity: Avoid calling sort_strings (NULL, 0) on empty list.
This commit is contained in:
@@ -105,8 +105,9 @@ foreach_block_device (block_dev_func_t func)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Sort the devices */
|
||||
sort_strings (r, size);
|
||||
/* Sort the devices. Note that r might be NULL if there are no devices. */
|
||||
if (r != NULL)
|
||||
sort_strings (r, size);
|
||||
|
||||
/* NULL terminate the list */
|
||||
if (add_string (&r, &size, &alloc, NULL) == -1) {
|
||||
|
||||
Reference in New Issue
Block a user