diff options
author | Ben Pfaff <blp@ovn.org> | 2018-01-25 15:39:47 -0800 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2018-01-26 14:23:11 -0800 |
commit | 2335ee9347188fef7cc68d0db3228f1b970518a3 (patch) | |
tree | 1c289341b85eafdfddc89605b08c6a8921718a15 /vtep | |
parent | 05b1dd234aeee05bb702d682f0ffc59739a4ec9a (diff) | |
download | openvswitch-2335ee9347188fef7cc68d0db3228f1b970518a3.tar.gz |
ovs-vsctl, vtep-ctl: Free 'args' string on exit.
This avoids a memory leak warning from valgrind.
ovn-sbctl and ovn-nbctl already followed this pattern.
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: William Tu <u9012063@gmail.com>
Diffstat (limited to 'vtep')
-rw-r--r-- | vtep/vtep-ctl.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/vtep/vtep-ctl.c b/vtep/vtep-ctl.c index 3af71498b..056dc687a 100644 --- a/vtep/vtep-ctl.c +++ b/vtep/vtep-ctl.c @@ -82,7 +82,7 @@ OVS_NO_RETURN static void usage(void); static void parse_options(int argc, char *argv[], struct shash *local_options); static void run_prerequisites(struct ctl_command[], size_t n_commands, struct ovsdb_idl *); -static void do_vtep_ctl(const char *args, struct ctl_command *, size_t n, +static bool do_vtep_ctl(const char *args, struct ctl_command *, size_t n, struct ovsdb_idl *); static struct vtep_ctl_lswitch *find_lswitch(struct vtep_ctl_context *, const char *name, @@ -144,7 +144,10 @@ main(int argc, char *argv[]) if (seqno != ovsdb_idl_get_seqno(idl)) { seqno = ovsdb_idl_get_seqno(idl); - do_vtep_ctl(args, commands, n_commands, idl); + if (do_vtep_ctl(args, commands, n_commands, idl)) { + free(args); + exit(EXIT_SUCCESS); + } } if (seqno == ovsdb_idl_get_seqno(idl)) { @@ -2257,7 +2260,7 @@ run_prerequisites(struct ctl_command *commands, size_t n_commands, } } -static void +static bool do_vtep_ctl(const char *args, struct ctl_command *commands, size_t n_commands, struct ovsdb_idl *idl) { @@ -2405,7 +2408,7 @@ do_vtep_ctl(const char *args, struct ctl_command *commands, ovsdb_idl_destroy(idl); - exit(EXIT_SUCCESS); + return true; try_again: /* Our transaction needs to be rerun, or a prerequisite was not met. Free @@ -2421,6 +2424,7 @@ try_again: free(c->table); } free(error); + return false; } static const struct ctl_command_syntax vtep_commands[] = { |