summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpctl
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2008-06-15 09:58:44 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2008-06-15 09:58:44 +0000
commitc5f321509ca0c35ad96236e6e72edd5e1e5bd91f (patch)
treea2d33c750a6f9dbc18ac1801ea86b74373cb616d /usr.sbin/bgpctl
parent0b18a6dc503758681b240e76c768c2ea8a7f9b37 (diff)
Fix minor mem leak in case parse_addr() fails.
Diffstat (limited to 'usr.sbin/bgpctl')
-rw-r--r--usr.sbin/bgpctl/parser.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/bgpctl/parser.c b/usr.sbin/bgpctl/parser.c
index 3ee603c0ad1..3bb988847be 100644
--- a/usr.sbin/bgpctl/parser.c
+++ b/usr.sbin/bgpctl/parser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parser.c,v 1.49 2008/06/11 03:19:39 tobias Exp $ */
+/* $OpenBSD: parser.c,v 1.50 2008/06/15 09:58:43 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -633,8 +633,10 @@ parse_prefix(const char *word, struct bgpd_addr *addr, u_int8_t *prefixlen)
err(1, "parse_prefix: malloc");
strlcpy(ps, word, strlen(word) - strlen(p) + 1);
- if (parse_addr(ps, addr) == 0)
+ if (parse_addr(ps, addr) == 0) {
+ free(ps);
return (0);
+ }
free(ps);
} else