From b932d88b16c8a48c332495ddd3f70ea97dc1abf1 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Mon, 15 Mar 2010 14:50:14 -0700 Subject: [PATCH] ovsdb-tool: Fix segfault if deleted row doesn't exist. This "can't happen" normally, but it will if you monkey with the OVSDB file by hand such that a row that gets deleted never actually existed in the db. --- ovsdb/ovsdb-tool.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ovsdb/ovsdb-tool.c b/ovsdb/ovsdb-tool.c index b2e200cbb..dedc179df 100644 --- a/ovsdb/ovsdb-tool.c +++ b/ovsdb/ovsdb-tool.c @@ -337,8 +337,13 @@ print_db_changes(struct shash *tables, struct shash *names) : xmemdup0(row_uuid, 8))); } } else if (columns->type == JSON_NULL) { + struct shash_node *node; + printf("\t\tdelete row\n"); - shash_delete(names, shash_find(names, row_uuid)); + node = shash_find(names, row_uuid); + if (node) { + shash_delete(names, node); + } free(old_name); } -- 2.43.0