summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorGopal Tiwari <gtiwari@redhat.com>2022-05-31 13:11:12 +0530
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2022-05-31 12:52:28 -0700
commit35cbfd9660949fca23418bfa32fd51d81ed91208 (patch)
tree986a20e756dc710745af2ba9d2a10f4a18ea185b /tools
parent4334be027ae1ad50193025c90e77a76b64464b53 (diff)
downloadbluez-35cbfd9660949fca23418bfa32fd51d81ed91208.tar.gz
mesh/mesh-db: Fix resource leaks
While performing static tool analysis using coverity found following reports for resouse leak bluez-5.64/tools/mesh/mesh-db.c:2388: leaked_handle: Handle variable "fd" going out of scope leaks the handle. bluez-5.64/tools/mesh/mesh-db.c:2388: leaked_storage: Variable "str" going out of scope leaks the storage it points to.
Diffstat (limited to 'tools')
-rw-r--r--tools/mesh/mesh-db.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/mesh/mesh-db.c b/tools/mesh/mesh-db.c
index fa11837df..896ff722c 100644
--- a/tools/mesh/mesh-db.c
+++ b/tools/mesh/mesh-db.c
@@ -2384,6 +2384,8 @@ bool mesh_db_load(const char *fname)
sz = read(fd, str, st.st_size);
if (sz != st.st_size) {
+ close(fd);
+ l_free(str);
l_error("Failed to read configuration file %s", fname);
return false;
}