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

Tim Wiederhake posted 5 patches 4 years, 9 months ago
[libvirt PATCH v2 5/5] virshCheckpointListCollect: Do not pass NULL to qsort
Posted by Tim Wiederhake 4 years, 9 months ago
Signed-off-by: Tim Wiederhake <twiederh@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

Re: [libvirt PATCH v2 5/5] virshCheckpointListCollect: Do not pass NULL to qsort
Posted by Laine Stump 4 years, 9 months ago
On 4/19/21 7:54 AM, Tim Wiederhake wrote:
> Signed-off-by: Tim Wiederhake <twiederh@redhat.com>

Reviewed-by: Laine Stump <laine@redhat.com>

I pushed all 5 patches.