diff options
author | Jakub Sitnicki <jkbs@redhat.com> | 2018-07-19 15:51:09 +0200 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2018-07-23 15:58:31 -0700 |
commit | 0d1eed891024f18be7b6ee50220fea6f343a6e2e (patch) | |
tree | 8d7ef992b15ddd2703ff75adc7a5c6eaa512cd56 /ovn/utilities | |
parent | 5c02f562409d5f077b883cfbe1f0a1729cb4a7ab (diff) | |
download | openvswitch-0d1eed891024f18be7b6ee50220fea6f343a6e2e.tar.gz |
ovn-nbctl: Pull up destroying commands from do_nbctl().
Destroy commands in the same routine where they were allocated.
Preparatory work for reusing the main loop in daemon mode.
Signed-off-by: Jakub Sitnicki <jkbs@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'ovn/utilities')
-rw-r--r-- | ovn/utilities/ovn-nbctl.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c index 4b2e64a77..6e71a8073 100644 --- a/ovn/utilities/ovn-nbctl.c +++ b/ovn/utilities/ovn-nbctl.c @@ -127,6 +127,13 @@ main(int argc, char *argv[]) main_loop(args, commands, n_commands, idl); + for (struct ctl_command *c = commands; c < &commands[n_commands]; c++) { + ds_destroy(&c->output); + table_destroy(c->table); + free(c->table); + shash_destroy_free_data(&c->options); + } + free(commands); free(args); exit(EXIT_SUCCESS); } @@ -4422,13 +4429,7 @@ do_nbctl(const char *args, struct ctl_command *commands, size_t n_commands, } else { fputs(ds_cstr(ds), stdout); } - ds_destroy(&c->output); - table_destroy(c->table); - free(c->table); - - shash_destroy_free_data(&c->options); } - free(commands); if (wait_type != NBCTL_WAIT_NONE && status != TXN_UNCHANGED) { ovsdb_idl_enable_reconnect(idl); |