[libvirt PATCH v2 5/5] virshCheckpointListCollect: Do not pass NULL to qsort

Tim Wiederhake twiederh at redhat.com
Mon Apr 19 11:54:15 UTC 2021


Signed-off-by: Tim Wiederhake <twiederh at redhat.com>
---
 tools/virsh-checkpoint.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/virsh-checkpoint.c b/tools/virsh-checkpoint.c
index afe849dd16..e88f9ffb47 100644
--- a/tools/virsh-checkpoint.c
+++ b/tools/virsh-checkpoint.c
@@ -628,7 +628,8 @@ virshCheckpointListCollect(vshControl *ctl,
         }
     }
 
-    if (!(orig_flags & VIR_DOMAIN_CHECKPOINT_LIST_TOPOLOGICAL))
+    if (!(orig_flags & VIR_DOMAIN_CHECKPOINT_LIST_TOPOLOGICAL) &&
+        checkpointlist->chks)
         qsort(checkpointlist->chks, checkpointlist->nchks,
               sizeof(*checkpointlist->chks), virshChkSorter);
 
-- 
2.26.3




More information about the libvir-list mailing list