From 6a7ff21e68586cd2519f060a0e12182918f5e80d Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 26 Mar 2016 02:28:32 +0100 Subject: iface: improve handling of name field --- src/iface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') 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; } -- cgit v1.2.3