Free memory allocated from table_add_column and table_add_row.
Test case: vsctl-bashcomp - basic verification/argument completion(7,8)
Call stack is below:
xrealloc (util.c:123)
table_add_column (table.c:146) or table_add_row (table.c:172)
do_list_tables (ovsdb-client.c:449)
main (ovsdb-client.c:151)
Signed-off-by: William Tu <u9012063@gmail.com>
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Co-authored-by: Daniele Di Proietto <diproiettod@vmware.com>
[blp@ovn.org removed an unneeded "if"]
Signed-off-by: Ben Pfaff <blp@ovn.org>
- * Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014, 2015 Nicira, Inc.
+ * Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
main(int argc, char *argv[])
{
const struct ovsdb_client_command *command;
main(int argc, char *argv[])
{
const struct ovsdb_client_command *command;
struct jsonrpc *rpc;
ovs_cmdl_proctitle_init(argc, argv);
struct jsonrpc *rpc;
ovs_cmdl_proctitle_init(argc, argv);
fetch_dbs(rpc, &dbs);
if (argc - optind > command->min_args
&& svec_contains(&dbs, argv[optind])) {
fetch_dbs(rpc, &dbs);
if (argc - optind > command->min_args
&& svec_contains(&dbs, argv[optind])) {
- database = argv[optind++];
+ database = xstrdup(argv[optind++]);
} else if (dbs.n == 1) {
database = xstrdup(dbs.names[0]);
} else if (svec_contains(&dbs, "Open_vSwitch")) {
} else if (dbs.n == 1) {
database = xstrdup(dbs.names[0]);
} else if (svec_contains(&dbs, "Open_vSwitch")) {
- database = "Open_vSwitch";
+ database = xstrdup("Open_vSwitch");
ovs_fatal(0, "no default database for `%s' command, please "
"specify a database name", command->name);
}
ovs_fatal(0, "no default database for `%s' command, please "
"specify a database name", command->name);
}
command->handler(rpc, database, argc - optind, argv + optind);
command->handler(rpc, database, argc - optind, argv + optind);
jsonrpc_close(rpc);
if (ferror(stdout)) {
jsonrpc_close(rpc);
if (ferror(stdout)) {
}
ovsdb_schema_destroy(schema);
table_print(&t, &table_style);
}
ovsdb_schema_destroy(schema);
table_print(&t, &table_style);
}
ovsdb_schema_destroy(schema);
table_print(&t, &table_style);
}
ovsdb_schema_destroy(schema);
table_print(&t, &table_style);