diff options
author | Damijan Skvarc <damjan.skvarc@gmail.com> | 2019-10-03 10:15:59 +0200 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2019-10-03 06:30:01 -0700 |
commit | 26228f445ce3ed39a5a046dfb49b761d6d0fc71a (patch) | |
tree | 723eff8358c45d41f7e0da34472a51f51bd1e0ce /ofproto | |
parent | 1bbc32df4b56b57a9685fe2e26dd5bfb70de1f03 (diff) | |
download | openvswitch-26228f445ce3ed39a5a046dfb49b761d6d0fc71a.tar.gz |
ofproto-dpif-xlate: Fix memory leak in is_neighbor_reply_correct() function
Memory leak happens while calling netdev_get_addr_list() function. This
function allocates memory for ip_addr and mask output arguments, but
this memory is never freed.
CC: Yifeng Sun <pkusunyifeng@gmail.com>
Fixes: dc0bd12f5b04 ("userspace: Enable non-bridge port as tunnel endpoint.")
Signed-off-by: Damijan Skvarc <damjan.skvarc@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'ofproto')
-rw-r--r-- | ofproto/ofproto-dpif-xlate.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index 9c31c06af..44f856dca 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -4027,10 +4027,14 @@ is_neighbor_reply_correct(const struct xlate_ctx *ctx, const struct flow *flow) HMAP_FOR_EACH (port, ofp_node, &ctx->xbridge->xports) { error = netdev_get_addr_list(port->netdev, &ip_addr, &mask, &n_in6); - if (!error && is_neighbor_reply_matched(flow, ip_addr)) { - /* Found a match. */ - ret = true; - break; + if (!error) { + ret = is_neighbor_reply_matched(flow, ip_addr); + free(ip_addr); + free(mask); + if (ret) { + /* Found a match. */ + break; + } } } } |