From: Sebastien GODARD <sysstat@users.noreply.github.com>
Date: Mon, 9 Dec 2019 16:54:07 +0000 (+0100)
Subject: Fix #242: Double free in check_file_actlst()
X-Git-Tag: v12.3.1~9
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a5c8abd4a481ee6e27a3acf00e6d9b0f023e20ed;p=sysstat

Fix #242: Double free in check_file_actlst()

Avoid freeing buffer() twice.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
---

diff --git a/sa_common.c b/sa_common.c
index cf52aef..856a371 100644
--- a/sa_common.c
+++ b/sa_common.c
@@ -2153,6 +2153,7 @@ void check_file_actlst(int *ifd, char *dfile, struct activity *act[], uint64_t f
 	}
 
 	free(buffer);
+	buffer = NULL;
 
 	/* Check that at least one activity selected by the user is available in file */
 	for (i = 0; i < NR_ACT; i++) {