From 8622b582da06fb93a8f06d302215269835fca9a9 Mon Sep 17 00:00:00 2001 From: Jaromir Capik Date: Thu, 2 Jan 2014 19:49:36 +0100 Subject: [PATCH] sysctl: Fixing memory leaks in PreloadSystem() --- sysctl.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sysctl.c b/sysctl.c index 33c94035..51af15dc 100644 --- a/sysctl.c +++ b/sysctl.c @@ -645,6 +645,13 @@ static int PreloadSystem(void) printf(_("* Applying %s ...\n"), DEFAULT_PRELOAD); rc |= Preload(DEFAULT_PRELOAD); } + + /* cleaning */ + for (i = 0; i < ncfgs; ++i) { + free(cfgs[i]); + } + if (cfgs) free(cfgs); + return rc; }