chiark / gitweb /
changelog, Makefile.in: finalise 0.3.3
[secnet.git] / tun.c
diff --git a/tun.c b/tun.c
index dcfd62392d825994665a787a88f3afe588230d3c..d4070f2ef405d7e8316bf23a84837189a05eddef 100644 (file)
--- a/tun.c
+++ b/tun.c
@@ -116,7 +116,7 @@ static void tun_afterpoll(void *sst, struct pollfd *fds, int nfds)
     if (fds[0].revents&POLLIN) {
        BUF_ALLOC(st->buff,"tun_afterpoll");
        buffer_init(st->buff,calculate_max_start_pad());
-       l=read(st->fd,st->buff->start,st->buff->len-calculate_max_start_pad());
+       l=read(st->fd, st->buff->start, buf_remaining_space(st->buff));
        if (l<0) {
            fatal_perror("tun_afterpoll: read()");
        }
@@ -240,9 +240,7 @@ static bool_t tun_set_route(void *sst, struct netlink_client *routes)
            fatal("tun_set_route: unsupported route command type");
            break;
        }
-       free(network); free(mask);
     }
-    free(secnetaddr);
     if (st->route_type==TUN_CONFIG_IOCTL) {
        close(fd);
     }