summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorAaron Marcher <me@drkhsh.at>2018-05-02 19:41:53 +0200
committerAaron Marcher <me@drkhsh.at>2018-05-02 19:41:53 +0200
commit699f6734d99ac67f9f1dceae2b7aeee8cb105d2f (patch)
tree3f6dc96f35c11dbb543989aec1d8016cc9a0d742 /components
parentaf3cdfbbc8dfbdb723fdfef8ac08a89fdee25f2e (diff)
wifi_perc: Fix file descriptor leak
Diffstat (limited to 'components')
-rw-r--r--components/wifi.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/components/wifi.c b/components/wifi.c
index 13b630a..7cd2702 100644
--- a/components/wifi.c
+++ b/components/wifi.c
@@ -30,10 +30,11 @@
strerror(errno));
return NULL;
}
- if(!(p = fgets(status, 5, fp)) || strcmp(status, "up\n") != 0) {
+ p = fgets(status, 5, fp);
+ fclose(fp);
+ if(!p || strcmp(status, "up\n") != 0) {
return NULL;
}
- fclose(fp);
if (!(fp = fopen("/proc/net/wireless", "r"))) {
fprintf(stderr, "fopen '/proc/net/wireless': %s\n",