[ovs-dev] [PATCH 1/8] ovsdb-tool: Fix segfault if deleted row doesn't exist.

Ben Pfaff blp at nicira.com
Mon Mar 15 22:42:49 UTC 2010


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 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/ovsdb/ovsdb-tool.c b/ovsdb/ovsdb-tool.c
index b2e200c..dedc179 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);
             }
 
-- 
1.6.6.1





More information about the dev mailing list