From 4195fcf3fcd2e79025ace0d052a1fe758c9eb7fa Mon Sep 17 00:00:00 2001 From: Robert Fekete Date: Tue, 14 Jun 2011 10:13:00 +0200 Subject: [b2r2lib] Fix Memory leak. When closing the library there was a memory leak and a handle not freed. ST-Ericsson ID: 344428 ST-Ericsson FOSS-OUT ID: Trivial Change-Id: I34e99fd4a2375702d69b3178421d141ec581113b Signed-off-by: Robert Fekete Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/25009 Reviewed-by: Magnus SMITH Reviewed-by: Himanshu AGRAWAL Tested-by: Himanshu AGRAWAL Reviewed-by: QATEST Reviewed-by: Maciej SOCHA --- src/blt_b2r2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/blt_b2r2.c b/src/blt_b2r2.c index 3afd093..5a73969 100644 --- a/src/blt_b2r2.c +++ b/src/blt_b2r2.c @@ -115,7 +115,7 @@ static struct blt_b2r2_data *get_data(int handle) { } static void free_handle(int handle) { - if (handle < data_count && handle > 0) { + if (handle < data_count && handle >= 0) { datas[handle] = NULL; } } @@ -195,6 +195,7 @@ void blt_close(int blt_handle) goto out; close(data->fd); + free_handle(blt_handle); free(data); out: -- cgit v1.2.3