]> git.ipfire.org Git - thirdparty/libvirt.git/commit
virsh: Don't infloop on snapshot/storage_vol failure
authorEric Blake <eblake@redhat.com>
Thu, 28 Mar 2019 02:15:43 +0000 (21:15 -0500)
committerEric Blake <eblake@redhat.com>
Thu, 28 Mar 2019 17:40:38 +0000 (12:40 -0500)
commit24b092c404a9d44a7eae6b0b17b2af3df8ecf601
tree48cb9001800498949bf2daacba666137e2f7bb84
parent83b1808ca2605b631828038094e96dcf8cc5e442
virsh: Don't infloop on snapshot/storage_vol failure

Most of our completers used the pattern:
if ((nITEM = virITEMListAll()) < 0)
    return NULL;

but the virDomainSnapshot and virStorageVolume completers were instead
using goto error. If the ListAll fails with -1, the cleanup label was
running a loop of 'size_t i < int nITEM', which is an extreme waste of
CPU cycles. Broken since their introduction in v4.1.

Fixes: f81f8b62
Fixes: 4cb4b649
Reported-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
tools/virsh-completer.c