Make free_prefixsets() accept a NULL pointer. Makes it behave more like
authorclaudio <claudio@openbsd.org>
Thu, 2 Aug 2018 12:46:02 +0000 (12:46 +0000)
committerclaudio <claudio@openbsd.org>
Thu, 2 Aug 2018 12:46:02 +0000 (12:46 +0000)
all other free functions bgpd has.

usr.sbin/bgpd/config.c
usr.sbin/bgpd/rde.c

index cdb6530..dcb47b6 100644 (file)
@@ -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 <henning@openbsd.org>
@@ -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);
index 96a1377..17225b7 100644 (file)
@@ -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 <henning@openbsd.org>
@@ -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");