]> git.ipfire.org Git - thirdparty/libvirt.git/commit
nss: Fix memory leak in findLease()
authorAlexander Kuznetsov <kuznetsovam@altlinux.org>
Tue, 15 Apr 2025 11:48:38 +0000 (14:48 +0300)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 15 Apr 2025 12:26:59 +0000 (14:26 +0200)
commitfaa98ca6d343586fefac9d6f011efc6a8032dcad
treeaf0dd47f33bbac72a73e7152628bd54f8ead79d2
parent5de27c32a18f1da4969a679a2385d45cf0279699
nss: Fix memory leak in findLease()

path is allocated by asprintf() and must be freed later if realloc() fails.

Restructure the code to allocate path only after realloc() succeeds,
avoiding the need for an extra free().

Found by Linux Verification Center (linuxtesting.org) with Svace.

Reported-by: Dmitry Fedin <d.fedin@fobos-nt.ru>
Signed-off-by: Alexander Kuznetsov <kuznetsovam@altlinux.org>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
tools/nss/libvirt_nss.c