Remove unused '#include's.
[tinc] / src / fd_device.c
index 0da8259..205b628 100644 (file)
@@ -31,7 +31,6 @@
 #include "logger.h"
 #include "net.h"
 #include "route.h"
-#include "utils.h"
 
 struct unix_socket_addr {
        size_t size;
@@ -116,7 +115,9 @@ end:
 }
 
 static struct unix_socket_addr parse_socket_addr(const char *path) {
-       struct sockaddr_un socket_addr;
+       struct sockaddr_un socket_addr = {
+               .sun_family = AF_UNIX,
+       };
        size_t path_length;
 
        if(strlen(path) >= sizeof(socket_addr.sun_path)) {
@@ -126,7 +127,6 @@ static struct unix_socket_addr parse_socket_addr(const char *path) {
                };
        }
 
-       socket_addr.sun_family = AF_UNIX;
        strncpy(socket_addr.sun_path, path, sizeof(socket_addr.sun_path));
 
        if(path[0] == '@') {
@@ -174,6 +174,10 @@ static bool setup_device(void) {
 static void close_device(void) {
        close(device_fd);
        device_fd = -1;
+       free(iface);
+       iface = NULL;
+       free(device);
+       device = NULL;
 }
 
 static inline uint16_t get_ip_ethertype(vpn_packet_t *packet) {