interface-ip: fix memory leak in interface_ip_add_target_route()
authorHans Dedecker <dedeckeh@gmail.com>
Sun, 1 Apr 2018 10:21:38 +0000 (12:21 +0200)
committerHans Dedecker <dedeckeh@gmail.com>
Mon, 2 Apr 2018 08:43:52 +0000 (10:43 +0200)
commit3dc8c916a94483bba2eed5ba34ccfc864866bb4e
tree6b843a5fd85103ed57ffa6b7f89a7de0eb5d958c
parent9c8d7816fc5e966b0c0efab9c1234734e0c5c254
interface-ip: fix memory leak in interface_ip_add_target_route()

Commit 9c8d781 introduced a memory leak in interface_ip_add_target_route
in case interface_ip_find_addr_target returns true for a given address
by not freeing the previously allocated route.
While at it rework the logic so a host route is only allocated when it's
really required.

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
interface-ip.c