diff --git a/ovsdb/condition.c b/ovsdb/condition.c index 5a3eb4e8a3f..4911fbf59be 100644 --- a/ovsdb/condition.c +++ b/ovsdb/condition.c @@ -550,9 +550,14 @@ ovsdb_condition_diff(struct ovsdb_condition *diff, &b->clauses[j]); } - diff->optimized = a->optimized && b->optimized; - if (diff->optimized) { - ovsdb_condition_optimize(diff); + if (diff->n_clauses) { + diff->optimized = a->optimized && b->optimized; + if (diff->optimized) { + ovsdb_condition_optimize(diff); + } + } else { + free(diff->clauses); + diff->clauses = NULL; } } diff --git a/ovsdb/monitor.c b/ovsdb/monitor.c index 4ccb51b1a98..d1e466faa48 100644 --- a/ovsdb/monitor.c +++ b/ovsdb/monitor.c @@ -824,6 +824,7 @@ ovsdb_monitor_table_condition_update( ovsdb_condition_destroy(&mtc->new_condition); ovsdb_condition_clone(&mtc->new_condition, &cond); ovsdb_condition_destroy(&cond); + ovsdb_condition_destroy(&mtc->diff_condition); ovsdb_condition_diff(&mtc->diff_condition, &mtc->old_condition, &mtc->new_condition); ovsdb_monitor_condition_add_columns(dbmon, diff --git a/tests/ovsdb-monitor.at b/tests/ovsdb-monitor.at index 12cd2bc3194..3e1df18a112 100644 --- a/tests/ovsdb-monitor.at +++ b/tests/ovsdb-monitor.at @@ -586,6 +586,7 @@ row,action,name,number,_version [[]], [], [[[[["name","==","one"],["name","==","two"]]]], + [[[["name","==","two"],["name","==","one"]]]], [[[["name","==","one"]]]], [[[false]]], [[[true]]]])