This is consistent with the other ref functions, and was causing
segmentation faults in some test cases.

Reported-by: Mukesh Hira <[email protected]>
Signed-off-by: Ethan Jackson <[email protected]>
---
 lib/bond.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/bond.c b/lib/bond.c
index 183c37b..b3ae0c4 100644
--- a/lib/bond.c
+++ b/lib/bond.c
@@ -195,8 +195,10 @@ bond_ref(const struct bond *bond_)
 {
     struct bond *bond = CONST_CAST(struct bond *, bond_);
 
-    ovs_assert(bond->ref_cnt > 0);
-    bond->ref_cnt++;
+    if (bond) {
+        ovs_assert(bond->ref_cnt > 0);
+        bond->ref_cnt++;
+    }
     return bond;
 }
 
-- 
1.7.9.5

_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev

Reply via email to