9425f0
From a61b382805961934c6425f19a762a6ab99884c24 Mon Sep 17 00:00:00 2001
9425f0
From: Liu Chao <liuchao173@huawei.com>
9425f0
Date: Thu, 30 Jun 2022 11:30:43 +0800
9425f0
Subject: [PATCH 11/14] fix memory leak in ui/ui.c
9425f0
9425f0
Signed-off-by: Liu Chao <liuchao173@huawei.com>
9425f0
---
9425f0
 ui/ui.c | 10 ++++------
9425f0
 1 file changed, 4 insertions(+), 6 deletions(-)
9425f0
9425f0
diff --git a/ui/ui.c b/ui/ui.c
9425f0
index 1e211de..6b1c689 100644
9425f0
--- a/ui/ui.c
9425f0
+++ b/ui/ui.c
9425f0
@@ -156,11 +156,10 @@ void print_all_cpus()
9425f0
 		for_each_int(setup.banned_cpus, get_banned_cpu, NULL);
9425f0
 		all_cpus = g_list_sort(all_cpus, sort_all_cpus);
9425f0
 	}
9425f0
-	int *line = malloc(sizeof(int));
9425f0
-	*line = 6;
9425f0
+	int line = 6;
9425f0
 	attrset(COLOR_PAIR(2));
9425f0
 	mvprintw(4, 3, "NUMBER          IS BANNED");
9425f0
-	for_each_cpu(all_cpus, print_cpu_line, line);
9425f0
+	for_each_cpu(all_cpus, print_cpu_line, &line);
9425f0
 }
9425f0
 
9425f0
 void add_banned_cpu(int *banned_cpu, void *data)
9425f0
@@ -364,13 +363,12 @@ void print_irq_line(irq_t *irq, void *data)
9425f0
 
9425f0
 void print_all_irqs()
9425f0
 {
9425f0
-	int *line = malloc(sizeof(int));
9425f0
-	*line = 4;
9425f0
+	int line = 4;
9425f0
 	attrset(COLOR_PAIR(0));
9425f0
 	mvprintw(2, 3,
9425f0
 			"NUMBER          IS BANNED        CLASS      \
9425f0
 			    ASSIGNED TO CPUS");
9425f0
-	for_each_irq(all_irqs, print_irq_line, line);
9425f0
+	for_each_irq(all_irqs, print_irq_line, &line);
9425f0
 }
9425f0
 
9425f0
 int toggle_irq(GList *irq_list, int position)
9425f0
-- 
9425f0
2.33.1
9425f0