]> git.ipfire.org Git - thirdparty/openvpn.git/commit
Fix memory leak in add_option() by simplifying get_ipv6_addr
authorSteffan Karger <steffan@karger.me>
Mon, 23 Nov 2015 20:58:55 +0000 (21:58 +0100)
committerGert Doering <gert@greenie.muc.de>
Tue, 24 Nov 2015 15:18:20 +0000 (16:18 +0100)
commit4f19cd1ddde3929d4a715ad59cd603eff16c66bf
tree982c8cf250b31d19e2fb41fc1900811aeb0b64c0
parentb33e1355765bbf83f4c8b744c442c7d98df808fa
Fix memory leak in add_option() by simplifying get_ipv6_addr

If get_ipv6_addr() would fail *after* allocating memory for ipv6_local,
add_option() would fail to free that memory.

The fix here is to remove the allocation from get_ipv6_addr(), and create
a separate function for the strip-and-allocate, such that failures are
easier to handle.

v2 - remove free(options->ifconfig_ipv6_local), since that is now handled
     by a garbage collector.

Memory leak found by coverity (in 2011!).

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1448312335-25908-1-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/10573
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 7e618994f3112ff4b29b9f08d087fb558636a6af)
src/openvpn/options.c
src/openvpn/options.h
src/openvpn/route.c