summaryrefslogtreecommitdiff
path: root/ovsdb/ovsdb-server.c
diff options
context:
space:
mode:
authorBen Pfaff <blp@ovn.org>2017-12-13 11:32:28 -0800
committerBen Pfaff <blp@ovn.org>2017-12-13 11:32:29 -0800
commit3865965dd99325bd7bcd5bd3ab2a5d059dd4832e (patch)
tree53341d4fb9f22465871db4d83b92babb9012b5a2 /ovsdb/ovsdb-server.c
parentdc92f724d4641bcf9fce95db262f314264e473af (diff)
downloadopenvswitch-3865965dd99325bd7bcd5bd3ab2a5d059dd4832e.tar.gz
ovsdb-error: New function ovsdb_error_to_string_free().
This allows slight code simplifications across the tree. Signed-off-by: Ben Pfaff <blp@ovn.org> Tested-by: Yifeng Sun <pkusunyifeng@gmail.com> Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
Diffstat (limited to 'ovsdb/ovsdb-server.c')
-rw-r--r--ovsdb/ovsdb-server.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c
index 1e0c20486..f9e4e529e 100644
--- a/ovsdb/ovsdb-server.c
+++ b/ovsdb/ovsdb-server.c
@@ -517,7 +517,7 @@ open_db(struct server_config *config, const char *filename)
db_error = ovsdb_file_open(db->filename, false, &db->db, &db->file);
if (db_error) {
- error = ovsdb_error_to_string(db_error);
+ error = ovsdb_error_to_string_free(db_error);
} else if (!ovsdb_jsonrpc_server_add_db(config->jsonrpc, db->db)) {
error = xasprintf("%s: duplicate database name", db->db->schema->name);
} else {
@@ -525,7 +525,6 @@ open_db(struct server_config *config, const char *filename)
return NULL;
}
- ovsdb_error_destroy(db_error);
close_db(db);
return error;
}
@@ -916,10 +915,9 @@ update_remote_status(const struct ovsdb_jsonrpc_server *jsonrpc,
db = node->data;
error = ovsdb_txn_commit(db->txn, false);
if (error) {
- char *msg = ovsdb_error_to_string(error);
+ char *msg = ovsdb_error_to_string_free(error);
VLOG_ERR_RL(&rl, "Failed to update remote status: %s", msg);
free(msg);
- ovsdb_error_destroy(error);
}
}
}
@@ -1157,10 +1155,9 @@ ovsdb_server_compact(struct unixctl_conn *conn, int argc,
error = ovsdb_file_compact(db->file);
if (error) {
- char *s = ovsdb_error_to_string(error);
+ char *s = ovsdb_error_to_string_free(error);
ds_put_format(&reply, "%s\n", s);
free(s);
- ovsdb_error_destroy(error);
}
n++;