From e8d82484b59c06eca9150541228537185a88765d Mon Sep 17 00:00:00 2001 From: Gopal Tiwari Date: Tue, 31 May 2022 13:11:12 +0530 Subject: [PATCH] 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. Signed-off-by: Manika Shrivastava Signed-off-by: Ayush Garg --- tools/mesh/mesh-db.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/mesh/mesh-db.c b/tools/mesh/mesh-db.c index 00cda86..86d7f08 100644 --- a/tools/mesh/mesh-db.c +++ b/tools/mesh/mesh-db.c @@ -2386,6 +2386,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; } -- 2.7.4