summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/rde.c
diff options
context:
space:
mode:
authorMoritz Buhl <mbuhl@cvs.openbsd.org>2022-11-07 22:48:36 +0000
committerMoritz Buhl <mbuhl@cvs.openbsd.org>2022-11-07 22:48:36 +0000
commit739d377ca29a407481ae6807a387e9f6690bb75f (patch)
treed988543a1eea3dcea08b60f66db255ad7190085d /usr.sbin/bgpd/rde.c
parent2af397f36fcb076b99adc5a33f74a8c5f15c14ad (diff)
Fix a memory leak in the error path of rde_dump_ctx_new.
ctx is leaked in case of an allocation in prefix_dump_new, prefix_dump_subtree, rib_dump_new, or rib_dump_subtree fails. Found by CodeChecker. OK claudio@
Diffstat (limited to 'usr.sbin/bgpd/rde.c')
-rw-r--r--usr.sbin/bgpd/rde.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c
index 95070004bb1..1d9730b9111 100644
--- a/usr.sbin/bgpd/rde.c
+++ b/usr.sbin/bgpd/rde.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.c,v 1.578 2022/09/23 15:49:20 claudio Exp $ */
+/* $OpenBSD: rde.c,v 1.579 2022/11/07 22:48:35 mbuhl Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -2739,6 +2739,7 @@ rde_dump_ctx_new(struct ctl_show_rib_request *req, pid_t pid,
error = CTL_RES_NOMEM;
imsg_compose(ibuf_se_ctl, IMSG_CTL_RESULT, 0, pid, -1, &error,
sizeof(error));
+ free(ctx);
return;
}