Skip to contentSkip to conversation

Memory accumulation problem

Openvpn-devel Marko Rauhamaa 1 participant 1 message Aug 9, 2007

lore
Share & tools
lore
#0 lore raw

In openvpn-2.0.9 socket_connect() (socket.c), print_sockaddr() consumes memory without bounds if the server is permanently down or unreachable becauses gc_free() is not called from within the loop.

Memory is consumed at 72 bytes every 5 seconds or 1.2 megabytes for each 24 hours (plus malloc overhead). That's enough to bring my openwrt box to its knees within a week or so.

Proposed solution (untested):

msg (D_LINK_ERRORS | M_ERRNO_SOCK,
"TCP: connect to %s failed, will try again in %d seconds", print_sockaddr (remote, &gc), connect_retry_seconds);
+ gc_free (&gc);
+ gc = gc_new ();

Marko

Signature · 1 line
Marko Rauhamaa      mailto:[email protected]...     http://pacujo.net/marko/