[PATCH] driver: Don't leak saved error in virGetConnectGeneric()

Ján Tomko jtomko at jtomko.net
Mon May 17 13:17:34 UTC 2021

On a Monday in 2021, Michal Privoznik wrote:
>Recently, a new code was added to virGetConnectGeneric() that
>saves the original error into a variable so that it's not lost in
>virConnectClose() called under the 'error' label.
>However, the error saving code uses virSaveLastError() +
>virSetError() combo which leaks the memory allocated for the
>error copy. Using virErrorPreserveLast() + virErrorRestore() does
>the same job without the memleak.
>Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> src/driver.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)

Reviewed-by: Ján Tomko <jtomko at redhat.com>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20210517/70b3e33f/attachment-0001.sig>

More information about the libvir-list mailing list