From 0b6ba191dc8f79148be565d3f6df948cb87f5db7 Mon Sep 17 00:00:00 2001 From: Timo Kokkonen Date: Mon, 11 Jul 2016 07:10:26 +0300 Subject: [PATCH] netstat_parser: Fix file descriptor leak Once data is read, close the descriptor to prevent a leak. Signed-off-by: Timo Kokkonen --- built_in_parsers.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/built_in_parsers.c b/built_in_parsers.c index f86da28..9a0d342 100644 --- a/built_in_parsers.c +++ b/built_in_parsers.c @@ -238,9 +238,11 @@ static int get_iface_stats(const char *iface, struct iface_stats *stat) stat->rx_bytes, stat->rx_packets, stat->tx_bytes, stat->tx_packets); + fclose(netdev); return 0; } + fclose(netdev); pr_err("Interface %s not found\n", iface); return -ENODEV; } -- 2.44.0