summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpctl
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2004-03-11 15:08:47 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2004-03-11 15:08:47 +0000
commit45407a908292408ae0126b84fb6135073a1cdeef (patch)
tree08e02a2042e84941a518abaf79cca1834919ea2d /usr.sbin/bgpctl
parentcae08498bed7ac1de188ecd1301c266036b576e3 (diff)
Plug another memory leak. OK henning@
Diffstat (limited to 'usr.sbin/bgpctl')
-rw-r--r--usr.sbin/bgpctl/bgpctl.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/usr.sbin/bgpctl/bgpctl.c b/usr.sbin/bgpctl/bgpctl.c
index 48d4dd786fa..e060a7c18e4 100644
--- a/usr.sbin/bgpctl/bgpctl.c
+++ b/usr.sbin/bgpctl/bgpctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpctl.c,v 1.45 2004/03/11 14:49:08 henning Exp $ */
+/* $OpenBSD: bgpctl.c,v 1.46 2004/03/11 15:08:46 claudio Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -688,17 +688,17 @@ show_rib_summary_msg(struct imsg *imsg)
struct ctl_show_rib_prefix *p;
u_char *asdata;
+ if (rib != NULL) {
+ free(rib);
+ rib = NULL;
+ }
+ if (aspath != NULL) {
+ free(aspath);
+ aspath = NULL;
+ }
+
switch (imsg->hdr.type) {
case IMSG_CTL_SHOW_RIB:
- if (rib != NULL) {
- free(rib);
- rib = NULL;
- }
- if (aspath != NULL) {
- free(aspath);
- aspath = NULL;
- }
-
if ((rib = malloc(imsg->hdr.len - IMSG_HEADER_SIZE)) == NULL)
err(1, NULL);
memcpy(rib, imsg->data, imsg->hdr.len - IMSG_HEADER_SIZE);