[irqbalance] [PATCH 2/2] irqbalance: properly close file descriptor

  • From: Petr Holasek <pholasek@xxxxxxxxxx>
  • To: irqbalance@xxxxxxxxxxxxx
  • Date: Thu, 19 Mar 2015 17:53:38 +0100

Signed-off-by: Petr Holasek <pholasek@xxxxxxxxxx>
---
 cputree.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/cputree.c b/cputree.c
index e249da8..d861dc7 100644
--- a/cputree.c
+++ b/cputree.c
@@ -82,7 +82,7 @@ static void setup_banned_cpus(void)
                goto out;
 
        if (getline(&line, &size, file) <= 0)
-               goto out;
+               goto out2;
 
        if ((c = strstr(line, isolcpus))) {
                char *end;
@@ -95,6 +95,8 @@ static void setup_banned_cpus(void)
                cpulist_parse(c, len, banned_cpus);
        }
 
+ out2:
+       fclose(file);
  out:
        cpumask_scnprintf(buffer, 4096, banned_cpus);
        log(TO_CONSOLE, LOG_INFO, "Isolated CPUs: %s\n", buffer);
-- 
2.1.0


Other related posts:

  • » [irqbalance] [PATCH 2/2] irqbalance: properly close file descriptor - Petr Holasek