summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Georg <mail@jensge.org>2019-08-22 20:25:52 +0200
committerJens Georg <mail@jensge.org>2019-10-01 23:03:06 +0200
commit7790cfb5665856d3862b7f55322a526f05014ad0 (patch)
tree0e6219da3ecf41223312d6ddfb6bbf8af5658c62
parenta4ed9c522c33e87afdeca34eecdd036ea3d8c6fd (diff)
downloadrygel-7790cfb5665856d3862b7f55322a526f05014ad0.tar.gz
core: Fix potential fd leak
Part of #137
-rw-r--r--src/librygel-core/rygel-energy-management-helper.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/librygel-core/rygel-energy-management-helper.c b/src/librygel-core/rygel-energy-management-helper.c
index 8883173a..2f399729 100644
--- a/src/librygel-core/rygel-energy-management-helper.c
+++ b/src/librygel-core/rygel-energy-management-helper.c
@@ -40,7 +40,7 @@ gboolean
rygel_energy_management_get_mac_and_network_type (const char *iface,
char **mac,
char **type) {
- int fd;
+ int fd = -1;
struct ifreq ifr;
gboolean retval = FALSE;
@@ -82,7 +82,7 @@ rygel_energy_management_get_mac_and_network_type (const char *iface,
retval = TRUE;
out:
- if (fd > 0) {
+ if (fd > -1) {
close (fd);
}