git.annexia.org
/
libguestfs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Coverity: Avoid calling sort_strings (NULL, 0) on empty list.
[libguestfs.git]
/
daemon
/
devsparts.c
diff --git
a/daemon/devsparts.c
b/daemon/devsparts.c
index
1781def
..
c8f0256
100644
(file)
--- a/
daemon/devsparts.c
+++ b/
daemon/devsparts.c
@@
-105,8
+105,9
@@
foreach_block_device (block_dev_func_t func)
return NULL;
}
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) {
/* NULL terminate the list */
if (add_string (&r, &size, &alloc, NULL) == -1) {