From: Vitaliy Cherepanov Date: Fri, 7 Aug 2015 13:34:17 +0000 (+0300) Subject: [FIX] skip line function X-Git-Tag: submit/tizen/20151105.065919~31 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=91d1fc25f4c53deda59970c41ab876feb95f4d43;p=platform%2Fcore%2Fsystem%2Fswap-manager.git [FIX] skip line function fix possible fail on reading proc files Change-Id: I883cc7a1902c54360fdc912e64d5f8d13bc7e54e Signed-off-by: Vitaliy Cherepanov --- 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)