On Wed, Mar 27, 2019 at 09:20:58PM -0500, Eric Blake wrote:
Most of our completers used the pattern:
if ((nITEM = virITEMListAll()) < 0)
return NULL;
but the virDomainSnapshot and virStorageVolume completers were instead
using goto error because of a prior allocation. 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.
Reported-by: Ján Tomko <jtomko(a)redhat.com>
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
This one is a bug fix, so worth having in 5.2.
tools/virsh-completer.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
Reviewed-by: Ján Tomko <jtomko(a)redhat.com>
Jano