]> git.puffer.fish Git - mirror/frr.git/commitdiff
pimd: Make sure we have valid pointer when printing debugs
authorDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 27 Oct 2016 22:27:28 +0000 (18:27 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 22 Dec 2016 01:26:12 +0000 (20:26 -0500)
When we print a debug in the pim_upstream_add, there
exists failure cases for pim_upstream_new where
we cannot create a upstream data structure.  Make
sure the debug handles it right.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
pimd/pim_upstream.c

index ee26683547fb4c2799af194d56aff6ffd86c3169..7264c0de55c560ef1bf8c9cf41968cd3f39f654f 100644 (file)
@@ -574,10 +574,17 @@ struct pim_upstream *pim_upstream_add(struct prefix_sg *sg,
   }
 
   if (PIM_DEBUG_TRACE)
-    zlog_debug("%s(%s): (%s), found: %d: ref_count: %d",
-              __PRETTY_FUNCTION__, name,
-              pim_str_sg_dump (&up->sg), found,
-              up->ref_count);
+    {
+      if (up)
+       zlog_debug("%s(%s): (%s), found: %d: ref_count: %d",
+                  __PRETTY_FUNCTION__, name,
+                  pim_str_sg_dump (&up->sg), found,
+                  up->ref_count);
+      else
+       zlog_debug("%s(%s): (%s) failure to create",
+                  __PRETTY_FUNCTION__, name,
+                  pim_str_sg_dump (sg));
+    }
 
   return up;
 }