From 6e4ef7f8a13147c15ac542f829b5a7b6a93ce239 Mon Sep 17 00:00:00 2001 From: liuchao173 <55137861+liuchao173@users.noreply.github.com> Date: Tue, 3 Dec 2019 09:30:40 +0800 Subject: [PATCH 45/53] free polscript to avoid resource leak free polscript when irqbalance exit or the same option is passed twice on the comand line --- irqbalance.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/irqbalance.c b/irqbalance.c index 5134f9d..e76d27b 100644 --- a/irqbalance.c +++ b/irqbalance.c @@ -153,6 +153,7 @@ static void parse_command_line(int argc, char **argv) add_cl_banned_irq((int)val); break; case 'l': + free(polscript); polscript = strdup(optarg); break; case 'm': @@ -702,8 +703,7 @@ int main(int argc, char** argv) out: free_object_tree(); free_cl_opts(); - if (polscript) - free(polscript); + free(polscript); /* Remove pidfile */ if (!foreground_mode && pidfile) -- 2.23.0