[hackers] [slstatus] wifi_perc: Fix file descriptor leak || Aaron Marcher
commit 699f6734d99ac67f9f1dceae2b7aeee8cb105d2f
Author: Aaron Marcher <me_AT_drkhsh.at>
AuthorDate: Wed May 2 19:41:53 2018 +0200
Commit: Aaron Marcher <me_AT_drkhsh.at>
CommitDate: Wed May 2 19:41:53 2018 +0200
wifi_perc: Fix file descriptor leak
diff --git a/components/wifi.c b/components/wifi.c
index 13b630a..7cd2702 100644
--- a/components/wifi.c
+++ b/components/wifi.c
_AT_@ -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",
Received on Wed May 02 2018 - 19:42:21 CEST
This archive was generated by hypermail 2.3.0
: Wed May 02 2018 - 19:48:33 CEST