projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix a tiny memory leak.
[tinc]
/
src
/
node.c
diff --git
a/src/node.c
b/src/node.c
index
820d622
..
465a48a
100644
(file)
--- a/
src/node.c
+++ b/
src/node.c
@@
-1,6
+1,6
@@
/*
node.c -- node tree management
/*
node.c -- node tree management
- Copyright (C) 2001-201
1
Guus Sliepen <guus@tinc-vpn.org>,
+ Copyright (C) 2001-201
2
Guus Sliepen <guus@tinc-vpn.org>,
2001-2005 Ivo Timmermans
This program is free software; you can redistribute it and/or modify
2001-2005 Ivo Timmermans
This program is free software; you can redistribute it and/or modify
@@
-30,7
+30,7
@@
#include "utils.h"
#include "xalloc.h"
#include "utils.h"
#include "xalloc.h"
-splay_tree_t *node_tree;
/* Known nodes, sorted by name */
+splay_tree_t *node_tree;
static hash_t *node_udp_cache;
node_t *myself;
static hash_t *node_udp_cache;
node_t *myself;
@@
-78,9
+78,8
@@
void free_node(node_t *n) {
ecdsa_free(&n->ecdsa);
sptps_stop(&n->sptps);
ecdsa_free(&n->ecdsa);
sptps_stop(&n->sptps);
- if(timeout_initialized(&n->mtuevent))
- event_del(&n->mtuevent);
-
+ timeout_del(&n->mtutimeout);
+
if(n->hostname)
free(n->hostname);
if(n->hostname)
free(n->hostname);
@@
-129,6
+128,13
@@
void update_node_udp(node_t *n, const sockaddr_t *sa) {
if(sa) {
n->address = *sa;
if(sa) {
n->address = *sa;
+ n->sock = 0;
+ for(int i = 0; i < listen_sockets; i++) {
+ if(listen_socket[i].sa.sa.sa_family == sa->sa.sa_family) {
+ n->sock = i;
+ break;
+ }
+ }
hash_insert(node_udp_cache, sa, n);
free(n->hostname);
n->hostname = sockaddr2hostname(&n->address);
hash_insert(node_udp_cache, sa, n);
free(n->hostname);
n->hostname = sockaddr2hostname(&n->address);