Blame SOURCES/0008-mesh-mesh-db-Fix-resource-leaks.patch

150e62
From 35cbfd9660949fca23418bfa32fd51d81ed91208 Mon Sep 17 00:00:00 2001
150e62
From: Gopal Tiwari <gtiwari@redhat.com>
150e62
Date: Tue, 31 May 2022 13:11:12 +0530
150e62
Subject: [PATCH BlueZ 08/12] mesh/mesh-db: Fix resource leaks
150e62
150e62
While performing static tool analysis using coverity found following
150e62
reports for resouse leak
150e62
150e62
bluez-5.64/tools/mesh/mesh-db.c:2388: leaked_handle: Handle variable
150e62
"fd" going out of scope leaks the handle.
150e62
150e62
bluez-5.64/tools/mesh/mesh-db.c:2388: leaked_storage: Variable "str"
150e62
going out of scope leaks the storage it points to.
150e62
---
150e62
 tools/mesh/mesh-db.c | 2 ++
150e62
 1 file changed, 2 insertions(+)
150e62
150e62
diff --git a/tools/mesh/mesh-db.c b/tools/mesh/mesh-db.c
150e62
index fa11837df..896ff722c 100644
150e62
--- a/tools/mesh/mesh-db.c
150e62
+++ b/tools/mesh/mesh-db.c
150e62
@@ -2384,6 +2384,8 @@ bool mesh_db_load(const char *fname)
150e62
 
150e62
 	sz = read(fd, str, st.st_size);
150e62
 	if (sz != st.st_size) {
150e62
+		close(fd);
150e62
+		l_free(str);
150e62
 		l_error("Failed to read configuration file %s", fname);
150e62
 		return false;
150e62
 	}
150e62
-- 
150e62
2.26.2
150e62