[PATCH] lib: fwts_gpe: fix double free on gpe buffer

Colin King colin.king at canonical.com
Fri Apr 21 09:24:51 UTC 2017


From: Colin Ian King <colin.king at canonical.com>

My previous memory leak fix introduced a double free bug, fix this by
not free'ing the buffer twice.  Issue detected by CoverityScan.

Fixes: 5a4034ff7938 ("lib: fwts_gpe: free original gpe buffer on failed realloc")

Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/lib/src/fwts_gpe.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/lib/src/fwts_gpe.c b/src/lib/src/fwts_gpe.c
index a16fee86..2b3db0f5 100644
--- a/src/lib/src/fwts_gpe.c
+++ b/src/lib/src/fwts_gpe.c
@@ -66,7 +66,6 @@ int fwts_gpe_read(fwts_gpe **gpes)
 
 			tmp = realloc(*gpes, sizeof(fwts_gpe) * (n+1));
 			if (!tmp) {
-				free(*gpes);
 				goto error;
 			} else {
 				char path[PATH_MAX];
-- 
2.11.0




More information about the fwts-devel mailing list