Trivial: Cleanup missing va_ends. 15/15515/2
authorPaul Vinciguerra <pvinci@vinciconsulting.com>
Wed, 24 Oct 2018 19:14:09 +0000 (12:14 -0700)
committerNeale Ranns <nranns@cisco.com>
Thu, 25 Oct 2018 14:30:49 +0000 (14:30 +0000)
Change-Id: Ie7827b6a31968a355687d27325c0f30cab1bc890
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
src/vnet/fib/fib_table.c
src/vnet/fib/fib_test.c
src/vnet/mfib/mfib_test.c

index 69746d9..f46a5b4 100644 (file)
@@ -1148,7 +1148,6 @@ fib_table_create_and_lock (fib_protocol_t proto,
     fib_node_index_t fi;
     va_list ap;
 
-    va_start(ap, fmt);
 
     switch (proto)
     {
@@ -1167,6 +1166,8 @@ fib_table_create_and_lock (fib_protocol_t proto,
 
     fib_table = fib_table_get(fi, proto);
 
+    va_start(ap, fmt);
+
     fib_table->ft_desc = va_format(fib_table->ft_desc, fmt, &ap);
 
     va_end(ap);
index 492369c..e26cc67 100644 (file)
@@ -212,7 +212,8 @@ fib_test_mk_intf (u32 ninterfaces)
 #define FIB_TEST_RPF(_cond, _comment, _args...)         \
     {                                                   \
         if (FIB_TEST_I(_cond, _comment, ##_args)) {     \
-            return (1);                                 \
+            res = 1;                                    \
+            goto cleanup;                               \
         }                                               \
     }
 
@@ -258,6 +259,7 @@ fib_test_urpf_is_equal (fib_node_index_t fei,
 
     dpo_reset(&dpo);
 
+cleanup:
     va_end(ap);
 
     return (res);
@@ -671,7 +673,6 @@ fib_test_validate_entry (fib_node_index_t fei,
     va_list ap;
     int res;
 
-    va_start(ap, n_buckets);
 
     res = 0;
     pfx = fib_entry_get_prefix(fei);
@@ -682,8 +683,10 @@ fib_test_validate_entry (fib_node_index_t fei,
     {
         const replicate_t *rep;
 
+        va_start(ap, n_buckets);
         rep = replicate_get(dpo.dpoi_index);
         res = fib_test_validate_rep_v(rep, n_buckets, &ap);
+        va_end (ap);
     }
     else
     {
@@ -694,8 +697,10 @@ fib_test_validate_entry (fib_node_index_t fei,
                     format_fib_prefix, pfx,
                     format_dpo_type, dpo.dpoi_type);
 
+        va_start(ap, n_buckets);
         lb = load_balance_get(dpo.dpoi_index);
         res = fib_test_validate_lb_v(lb, n_buckets, &ap);
+        va_end(ap);
 
         /*
          * ensure that the LB contributed by the entry is the
@@ -736,8 +741,6 @@ fib_test_validate_entry (fib_node_index_t fei,
 
     dpo_reset(&dpo);
 
-    va_end(ap);
-
     return (res);
 }
 
index 2a12a38..fda0258 100644 (file)
@@ -229,7 +229,6 @@ mfib_test_entry (fib_node_index_t fei,
     va_list ap;
     int res;
 
-    va_start(ap, n_buckets);
 
     res = 0;
     mfe = mfib_entry_get(fei);
@@ -263,12 +262,13 @@ mfib_test_entry (fib_node_index_t fei,
                       format_mfib_prefix, &pfx,
                       format_dpo_type, tmp.dpoi_type);
 
+        va_start(ap, n_buckets);
         res = mfib_test_validate_rep_v(rep, n_buckets, &ap);
+        va_end(ap);
 
         dpo_reset(&tmp);
     }
 
-    va_end(ap);
 
     return (res);
 }