]> git.proxmox.com Git - mirror_qemu.git/commit
qemu-io: Don't leak pattern file in error path
authorKevin Wolf <kwolf@redhat.com>
Tue, 10 Sep 2019 07:03:06 +0000 (09:03 +0200)
committerKevin Wolf <kwolf@redhat.com>
Fri, 13 Sep 2019 10:18:37 +0000 (12:18 +0200)
commitc8e68b43e11b003a4fcd6d61af448967d7a66631
treea6e1d52b2f02ac3e31f2575c6567e31c4ab31871
parent4e08bee46709f07e597431a75aa5efec9866bf9f
qemu-io: Don't leak pattern file in error path

qemu_io_alloc_from_file() needs to close the pattern file even if some
error occurred.

Setting f = NULL in the success path and checking it for NULL in the
error path isn't strictly necessary at this point, but let's do it
anyway in case someone later adds a 'goto error' after closing the file.

Coverity: CID 1405303
Fixes: 4d731510d34f280ed45a6de621d016f67a49ea48
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
qemu-io-cmds.c