From bdff1025985e7d907150fb0ba086cb3eaddbb785 Mon Sep 17 00:00:00 2001 From: jsg Date: Mon, 19 Oct 2015 14:15:59 +0000 Subject: [PATCH] fix memory leaks in error paths ok renato@ --- usr.sbin/eigrpd/parse.y | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/usr.sbin/eigrpd/parse.y b/usr.sbin/eigrpd/parse.y index f8b1ac8f07c..99b6903423c 100644 --- a/usr.sbin/eigrpd/parse.y +++ b/usr.sbin/eigrpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.2 2015/10/04 22:54:38 renato Exp $ */ +/* $OpenBSD: parse.y,v 1.3 2015/10/19 14:15:59 jsg Exp $ */ /* * Copyright (c) 2015 Renato Westphal @@ -1161,14 +1161,19 @@ host(const char *s, union eigrpd_addr *addr, uint8_t *plen) memset(addr, 0, sizeof(union eigrpd_addr)); switch (af) { case AF_INET: - if (inet_pton(AF_INET, ps, &addr->v4) != 1) + if (inet_pton(AF_INET, ps, &addr->v4) != 1) { + free(ps); return (-1); + } break; case AF_INET6: - if (inet_pton(AF_INET6, ps, &addr->v6) != 1) + if (inet_pton(AF_INET6, ps, &addr->v6) != 1) { + free(ps); return (-1); + } break; default: + free(ps); return (-1); } eigrp_applymask(af, addr, addr, *plen); -- 2.20.1