]> git.ipfire.org Git - thirdparty/libvirt.git/commit
libxl: fix coverity issues introduced by 6a95edf
authorJoao Martins <joao.m.martins@oracle.com>
Thu, 16 Feb 2017 16:43:05 +0000 (16:43 +0000)
committerJohn Ferlan <jferlan@redhat.com>
Thu, 16 Feb 2017 17:19:35 +0000 (12:19 -0500)
commit1e6bc3c5811728b9f346afb6ca44bee19217ffc5
tree860ac001ad66d549edc9ab9fdc1933484cf0c2ed
parent1d9ab0f04af310e52f80b4281751655bb3bb7601
libxl: fix coverity issues introduced by 6a95edf

As discussed here [0][1] Coverity reported two issues:

- On libxlDomainMigrationPrepareTunnel3 @@mig will be leaked on failures
after sucessfull call libxlDomainMigrationPrepareAny hence we free it.

Setting mig = NULL after @mig is assigned plus adding libxlMigrationCookieFree
on error paths addresses the issue. In case virThreadCreate fails,
unref of args frees the cookie on dispose function (libxlMigrationDstArgsDispose)

- On libxlMigrationStartTunnel @tc would be leaked.

Fixed by correctly saving the newly allocated @tc onto @tnl such that
libxlMigrationStopTunnel would free it up.

[0] https://www.redhat.com/archives/libvir-list/2017-February/msg00791.html
[1] https://www.redhat.com/archives/libvir-list/2017-February/msg00833.html

Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
src/libxl/libxl_migration.c