]> xenbits.xensource.com Git - libvirt.git/commit
qemu: Move qemuAgentFSInfo array free into qemuDomainGetFSInfo()
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 16 Feb 2021 10:27:56 +0000 (11:27 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 16 Feb 2021 13:06:31 +0000 (14:06 +0100)
commit59c80e9fd0cc0d6ca9ca1ecddf1fa9173321027c
tree90018ec1b9eaa9ccb1ec8166deca934dc0fd062b
parent5922b2b104d60965fbf367e042dbb4dee366a424
qemu: Move qemuAgentFSInfo array free into qemuDomainGetFSInfo()

When qemuDomainGetFSInfo() is called it calls
qemuDomainGetFSInfoAgent() which executes 'guest-get-fsinfo'
guest agent command, parses returned JSON and returns an array of
qemuAgentFSInfo structures (well, pointers to those structs).
Then it grabs a domain job and tries to do some matching of guest
returned info against domain definition. This matching is done in
virDomainFSInfoFormat() which also frees the array of
qemuAgentFSInfo structures allocated earlier.

But this is not just. If acquiring the domain job fails (or
domain activeness check executed right after that fails) then
virDomainFSInfoFormat() is not called, leaking the array of
structs.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_driver.c