We still check for realloc's return value in the nss module.
Free the path in case it fails before jumping to cleanup.
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
tools/nss/libvirt_nss.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/nss/libvirt_nss.c b/tools/nss/libvirt_nss.c
index b021efc3c9..87a731da79 100644
--- a/tools/nss/libvirt_nss.c
+++ b/tools/nss/libvirt_nss.c
@@ -138,8 +138,10 @@ findLease(const char *name,
goto cleanup;
tmpLease = realloc(leaseFiles, sizeof(char *) * (nleaseFiles + 1));
- if (!tmpLease)
+ if (!tmpLease) {
+ free(path);
goto cleanup;
+ }
leaseFiles = tmpLease;
leaseFiles[nleaseFiles++] = path;
#if defined(LIBVIRT_NSS_GUEST)
--
2.29.2