diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2011-06-08 22:01:41 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2011-06-13 14:21:49 +0100 |
commit | d19ed53dc8c62fa2b995890bf015c66e758a429a (patch) | |
tree | 0b88e5de64fc55037b7a95fcdc1c134b3a6449cd /daemon/devsparts.c | |
parent | 17cd021aef3cc7f6aae57da1b9f84dff9dfc041c (diff) | |
download | libguestfs-d19ed53dc8c62fa2b995890bf015c66e758a429a.tar.gz libguestfs-d19ed53dc8c62fa2b995890bf015c66e758a429a.tar.xz libguestfs-d19ed53dc8c62fa2b995890bf015c66e758a429a.zip |
Coverity: Avoid calling sort_strings (NULL, 0) on empty list.
(cherry picked from commit 3ed8d5122026f37dd96cc7e8503c4f3ecf0afbb7)
Diffstat (limited to 'daemon/devsparts.c')
-rw-r--r-- | daemon/devsparts.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/daemon/devsparts.c b/daemon/devsparts.c index 1781def3..c8f0256a 100644 --- a/daemon/devsparts.c +++ b/daemon/devsparts.c @@ -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) { |