summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2016-03-26 02:28:32 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2016-03-26 02:28:32 +0100
commit6a7ff21e68586cd2519f060a0e12182918f5e80d (patch)
treefc66db41b4810b1d05bd09ae83289647ce81bc67
parentf5820021ef15bfe7fb967f9187f15e6b6f5e9d4a (diff)
downloadfastd-6a7ff21e68586cd2519f060a0e12182918f5e80d.tar
fastd-6a7ff21e68586cd2519f060a0e12182918f5e80d.zip
iface: improve handling of name field
-rw-r--r--src/iface.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/iface.c b/src/iface.c
index 917ab2f..b2b0d55 100644
--- a/src/iface.c
+++ b/src/iface.c
@@ -160,7 +160,6 @@ static void open_iface(fastd_iface_t *iface, const char *ifname, uint16_t mtu) {
pr_debug("using android TUN fd");
iface->fd = FASTD_POLL_FD(POLL_TYPE_IFACE, fastd_android_receive_tunfd());
- iface->name = NULL;
fastd_android_send_pid();
} else {
@@ -514,7 +513,7 @@ fastd_iface_t * fastd_iface_open(fastd_peer_t *peer) {
}
}
- fastd_iface_t *iface = fastd_new(fastd_iface_t);
+ fastd_iface_t *iface = fastd_new0(fastd_iface_t);
iface->peer = peer;
iface->mtu = fastd_peer_get_mtu(peer);
@@ -522,6 +521,7 @@ fastd_iface_t * fastd_iface_open(fastd_peer_t *peer) {
open_iface(iface, ifname, iface->mtu);
if (iface->fd.fd < 0) {
+ free(iface->name);
free(iface);
return NULL;
}