summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2008-12-28 02:07:13 +0000
committerChristian Pointner <equinox@anytun.org>2008-12-28 02:07:13 +0000
commit5a38cf910fdba0a9a46305fc1480950c208ce66b (patch)
tree398a1f17c55fc72fffecd8d4cbc0ee34a104ed58 /src
parentadded udp socket (diff)
fixed memory error und udp_close
Diffstat (limited to 'src')
-rw-r--r--src/uanytun.c2
-rw-r--r--src/udp.c3
2 files changed, 5 insertions, 0 deletions
diff --git a/src/uanytun.c b/src/uanytun.c
index ca16446..27d1880 100644
--- a/src/uanytun.c
+++ b/src/uanytun.c
@@ -71,6 +71,7 @@ int main(int argc, char* argv[])
exit(-1);
}
+
log_printf(INFO, "entering main loop");
u_int8_t buf[1600];
int len = 0;
@@ -82,6 +83,7 @@ int main(int argc, char* argv[])
cnt++;
}
tun_close(&dev);
+ udp_close(&sock);
return 0;
}
diff --git a/src/udp.c b/src/udp.c
index 927e4b2..b5701ad 100644
--- a/src/udp.c
+++ b/src/udp.c
@@ -114,6 +114,9 @@ void udp_close(udp_socket_t** sock)
if((*sock)->fd_ > 0)
close((*sock)->fd_);
+
+ free(*sock);
+ *sock = NULL;
}
int udp_read(udp_socket_t* sock, u_int8_t* buf, u_int32_t len, struct sockaddr_storage* remote_end_)