X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=ovsdb%2Frow.c;h=5043cbc04bc84037c01d879c9cc1dae403e0fd50;hb=ee5311097049272834308f64931172f1c8210755;hp=d088ff98a1c6a7e957c7549fbed30dc3cf31448d;hpb=02dd3123a0e312f1d33403e744af52dd6096f12d;p=sliver-openvswitch.git diff --git a/ovsdb/row.c b/ovsdb/row.c index d088ff98a..5043cbc04 100644 --- a/ovsdb/row.c +++ b/ovsdb/row.c @@ -35,6 +35,8 @@ allocate_row(const struct ovsdb_table *table) struct ovsdb_row *row = xmalloc(row_size); row->table = (struct ovsdb_table *) table; row->txn_row = NULL; + list_init(&row->src_refs); + list_init(&row->dst_refs); row->n_refs = 0; return row; } @@ -77,8 +79,23 @@ ovsdb_row_destroy(struct ovsdb_row *row) { if (row) { const struct ovsdb_table *table = row->table; + struct ovsdb_weak_ref *weak, *next; const struct shash_node *node; + LIST_FOR_EACH_SAFE (weak, next, struct ovsdb_weak_ref, dst_node, + &row->dst_refs) { + list_remove(&weak->src_node); + list_remove(&weak->dst_node); + free(weak); + } + + LIST_FOR_EACH_SAFE (weak, next, struct ovsdb_weak_ref, src_node, + &row->src_refs) { + list_remove(&weak->src_node); + list_remove(&weak->dst_node); + free(weak); + } + SHASH_FOR_EACH (node, &table->schema->columns) { const struct ovsdb_column *column = node->data; ovsdb_datum_destroy(&row->fields[column->index], &column->type);