mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
virt-login-shell: silence coverity warning
Coverity spotted that 'nfdlist' (ssize_t) could be -1, but that we were using 'i' (size_t) to iterate over the list at cleanup, with crashing results because it promotes to a really big unsigned number. * tools/virt-login-shell.c (main): Avoid treating -1 as unsigned. Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
2c4870d04f
commit
cb9bd7963b
@ -339,8 +339,9 @@ main(int argc, char **argv)
|
||||
/* At this point, the parent is now waiting for the child to exit,
|
||||
* but as that may take a long time, we release resources now. */
|
||||
cleanup:
|
||||
for (i = 0; i < nfdlist; i++)
|
||||
VIR_FORCE_CLOSE(fdlist[i]);
|
||||
if (nfdlist > 0)
|
||||
for (i = 0; i < nfdlist; i++)
|
||||
VIR_FORCE_CLOSE(fdlist[i]);
|
||||
VIR_FREE(fdlist);
|
||||
virConfFree(conf);
|
||||
if (dom)
|
||||
|
Loading…
Reference in New Issue
Block a user