From: Ben Pfaff Date: Mon, 15 Mar 2010 21:50:14 +0000 (-0700) Subject: ovsdb-tool: Fix segfault if deleted row doesn't exist. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b932d88b16c8a48c332495ddd3f70ea97dc1abf1;p=openvswitch 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. --- diff --git a/ovsdb/ovsdb-tool.c b/ovsdb/ovsdb-tool.c index b2e200cb..dedc179d 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); }