X-Git-Url: https://www.tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fnode.c;h=cf70f8380e12df58641c01d03740135dc3252b13;hp=a533cee61ffe8e72441bd4bb8bb70fab44b0a276;hb=95968c67f9df9102ddbce5b7c8d34107989ad51a;hpb=23acc19bc090051156ad895caed61848f5afb144 diff --git a/src/node.c b/src/node.c index a533cee6..cf70f838 100644 --- a/src/node.c +++ b/src/node.c @@ -1,6 +1,6 @@ /* node.c -- node tree management - Copyright (C) 2001-2009 Guus Sliepen , + Copyright (C) 2001-2011 Guus Sliepen , 2001-2005 Ivo Timmermans This program is free software; you can redistribute it and/or modify @@ -92,6 +92,9 @@ void free_node(node_t *n) { if(n->name) free(n->name); + if(n->late) + free(n->late); + free(n); } @@ -121,7 +124,7 @@ void node_del(node_t *n) { } node_t *lookup_node(char *name) { - node_t n = {0}; + node_t n = {NULL}; n.name = name; @@ -129,7 +132,7 @@ node_t *lookup_node(char *name) { } node_t *lookup_node_udp(const sockaddr_t *sa) { - node_t n = {0}; + node_t n = {NULL}; n.address = *sa; n.name = NULL; @@ -138,6 +141,11 @@ node_t *lookup_node_udp(const sockaddr_t *sa) { } void update_node_udp(node_t *n, const sockaddr_t *sa) { + if(n == myself) { + logger(LOG_WARNING, "Trying to update UDP address of myself!"); + return; + } + avl_delete(node_udp_tree, n); if(n->hostname) @@ -150,7 +158,7 @@ void update_node_udp(node_t *n, const sockaddr_t *sa) { ifdebug(PROTOCOL) logger(LOG_DEBUG, "UDP address of %s set to %s", n->name, n->hostname); } else { memset(&n->address, 0, sizeof n->address); - n->hostname = 0; + n->hostname = NULL; ifdebug(PROTOCOL) logger(LOG_DEBUG, "UDP address of %s cleared", n->name); } }