summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2008-06-15 09:58:43 +0000
committerclaudio <claudio@openbsd.org>2008-06-15 09:58:43 +0000
commit17aad25ca151e4e0322e31089d0b558b64cf45ee (patch)
tree4c7a3e4af7ae65314f02323caac417b1533c805e
parenttweak the code that finds packages to find distant stems (diff)
downloadwireguard-openbsd-17aad25ca151e4e0322e31089d0b558b64cf45ee.tar.xz
wireguard-openbsd-17aad25ca151e4e0322e31089d0b558b64cf45ee.zip
Fix minor mem leak in case parse_addr() fails.
-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