[quagga-dev,15564,13/16] pimd: don't leak original_s_route on error

Message ID 1465927630-27768-13-git-send-email-chris@opensourcerouting.org
State Under Review
Headers show
Series
  • [quagga-dev,15552,01/16] zebra: fix null pointer dereference in zsend_ipv4_nexthop_lookup_mrib
Related show

Commit Message

Christian Franke June 14, 2016, 6:07 p.m.
From: Christian Franke <nobody@nowhere.ws>

original_s_route is allocated on the heap and was not freed during the
error case.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
---
 pimd/pim_static.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Donald Sharp June 16, 2016, 1:40 p.m. | #1
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>

On Tue, Jun 14, 2016 at 2:07 PM, Christian Franke
<chris@opensourcerouting.org> wrote:
> From: Christian Franke <nobody@nowhere.ws>
>
> original_s_route is allocated on the heap and was not freed during the
> error case.
>
> Signed-off-by: Christian Franke <chris@opensourcerouting.org>
> ---
>  pimd/pim_static.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/pimd/pim_static.c b/pimd/pim_static.c
> index cbbcaaa..4038c68 100644
> --- a/pimd/pim_static.c
> +++ b/pimd/pim_static.c
> @@ -194,6 +194,10 @@ int pim_static_add(struct interface *iif, struct interface *oif, struct in_addr
>           pim_static_route_free(s_route);
>        }
>
> +      if (original_s_route) {
> +         pim_static_route_free(original_s_route);
> +      }
> +
>        return -1;
>     }
>
> --
> 2.8.0
>
>
> _______________________________________________
> Quagga-dev mailing list
> Quagga-dev@lists.quagga.net
> https://lists.quagga.net/mailman/listinfo/quagga-dev

Patch hide | download patch | download mbox

diff --git a/pimd/pim_static.c b/pimd/pim_static.c
index cbbcaaa..4038c68 100644
--- a/pimd/pim_static.c
+++ b/pimd/pim_static.c
@@ -194,6 +194,10 @@  int pim_static_add(struct interface *iif, struct interface *oif, struct in_addr
          pim_static_route_free(s_route);
       }
 
+      if (original_s_route) {
+         pim_static_route_free(original_s_route);
+      }
+
       return -1;
    }