[PATCH] lib: Check return value of rib_init

  • From: Dimitri Staessens <dimitri@ouroboros.rocks>
  • To: ouroboros@xxxxxxxxxxxxx
  • Date: Sat, 26 Feb 2022 12:01:58 +0100

The rib_init return value wasn't checked.

Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>
---
 src/lib/dev.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/lib/dev.c b/src/lib/dev.c
index ab02a783..31941afd 100644
--- a/src/lib/dev.c
+++ b/src/lib/dev.c
@@ -466,11 +466,16 @@ static void init(int     argc,
         if (strstr(argv[0], "ipcpd") == NULL) {
                 sprintf(procstr, "proc.%d", getpid());
                 /* Don't bail on fail, it just won't show metrics */
-                rib_init(procstr);
+                if (rib_init(procstr) < 0)
+                        goto fail_rib_init;
         }
 #endif
         return;
 
+#if defined PROC_FLOW_STATS
+ fail_rib_init:
+        timerwheel_fini();
+#endif
  fail_timerwheel:
         shm_flow_set_close(ai.fqset);
  fail_fqset:
-- 
2.35.1


Other related posts:

  • » [PATCH] lib: Check return value of rib_init - Dimitri Staessens