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

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