From 91d1fc25f4c53deda59970c41ab876feb95f4d43 Mon Sep 17 00:00:00 2001 From: Vitaliy Cherepanov Date: Fri, 7 Aug 2015 16:34:17 +0300 Subject: [PATCH] [FIX] skip line function fix possible fail on reading proc files Change-Id: I883cc7a1902c54360fdc912e64d5f8d13bc7e54e Signed-off-by: Vitaliy Cherepanov --- daemon/sys_stat.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/daemon/sys_stat.c b/daemon/sys_stat.c index 2abe299..52083a2 100644 --- a/daemon/sys_stat.c +++ b/daemon/sys_stat.c @@ -1505,10 +1505,11 @@ static void skip_lines(FILE * fp, unsigned int count) size_t buflen; unsigned int index; for (index = 0; index != count; ++index) { + buffer = NULL; if (getline(&buffer, &buflen, fp) < 0) LOGE("file scan fail\n"); + free(buffer); } - free(buffer); } static int skip_tokens(FILE * fp, unsigned int count) -- 2.7.4