From 48b52ae645d60974a79aa874877612a682474d86 Mon Sep 17 00:00:00 2001 From: Phil <80522768+Nasty07@users.noreply.github.com> Date: Wed, 18 Jan 2023 19:44:29 +0200 Subject: [PATCH] strdup() mem leak fix (#33) * Mem leak fix Memleak fix for strdup() * Typo fix forgot ; --- src/xdpfw.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/xdpfw.c b/src/xdpfw.c index 149a8a5..c0b6f8e 100644 --- a/src/xdpfw.c +++ b/src/xdpfw.c @@ -512,6 +512,10 @@ int main(int argc, char *argv[]) // Check for auto-update. if (cfg.updatetime > 0 && (curTime - lastupdated) > cfg.updatetime) { + // Memleak fix for strdup() in updateconfig() + // Before updating it again, we need to free the old return value + free(cfg.interface); + // Update config. updateconfig(&cfg, cmd.cfgfile);