From: Ben Pfaff Date: Thu, 5 Mar 2009 01:16:16 +0000 (-0800) Subject: classifier: Tolerate old==new in cls_rule_moved(). X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e2674cd9f663b5d6ab8fbd5bdce316d46768406f;p=openvswitch classifier: Tolerate old==new in cls_rule_moved(). The primary purpose of cls_rule_moved() is to deal gracefully with memory blocks that have been realloc()'d. realloc() can return the original memory block so it's best to tolerate that instead of assert-failing. --- diff --git a/lib/classifier.c b/lib/classifier.c index c27113b3..52cad760 100644 --- a/lib/classifier.c +++ b/lib/classifier.c @@ -117,11 +117,12 @@ void cls_rule_moved(struct classifier *cls, struct cls_rule *old, struct cls_rule *new) { - assert(old != new); - if (new->wc.wildcards) { - list_moved(&new->node.list); - } else { - hmap_moved(&cls->exact_table, &old->node.hmap, &new->node.hmap); + if (old != new) { + if (new->wc.wildcards) { + list_moved(&new->node.list); + } else { + hmap_moved(&cls->exact_table, &old->node.hmap, &new->node.hmap); + } } }