From e2674cd9f663b5d6ab8fbd5bdce316d46768406f Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 4 Mar 2009 17:16:16 -0800 Subject: [PATCH] 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. --- lib/classifier.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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); + } } } -- 2.30.2