From 1d146b530532094d95d33179b9643e4d60201dcc Mon Sep 17 00:00:00 2001 From: claudio Date: Thu, 2 Aug 2018 12:46:02 +0000 Subject: [PATCH] Make free_prefixsets() accept a NULL pointer. Makes it behave more like all other free functions bgpd has. --- usr.sbin/bgpd/config.c | 4 +++- usr.sbin/bgpd/rde.c | 5 ++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/usr.sbin/bgpd/config.c b/usr.sbin/bgpd/config.c index cdb65308a36..dcb47b64894 100644 --- a/usr.sbin/bgpd/config.c +++ b/usr.sbin/bgpd/config.c @@ -1,4 +1,4 @@ -/* $OpenBSD: config.c,v 1.69 2018/07/11 21:10:07 benno Exp $ */ +/* $OpenBSD: config.c,v 1.70 2018/08/02 12:46:02 claudio Exp $ */ /* * Copyright (c) 2003, 2004, 2005 Henning Brauer @@ -119,6 +119,8 @@ free_prefixsets(struct prefixset_head *psh) struct prefixset *ps; struct prefixset_item *psi; + if (psh == NULL) + return; while (!SIMPLEQ_EMPTY(psh)) { ps = SIMPLEQ_FIRST(psh); diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c index 96a137729df..17225b73d9b 100644 --- a/usr.sbin/bgpd/rde.c +++ b/usr.sbin/bgpd/rde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.404 2018/08/02 09:46:35 claudio Exp $ */ +/* $OpenBSD: rde.c,v 1.405 2018/08/02 12:46:02 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -2831,8 +2831,7 @@ rde_reload_done(void) ribs[rid].state = RECONF_NONE; } - if (prefixsets_old != NULL) - free_prefixsets(prefixsets_old); + free_prefixsets(prefixsets_old); prefixsets_old = NULL; log_info("RDE reconfigured"); -- 2.20.1