Signed-off-by: Jakob Meng <code@jakobmeng.de>
@@ -88,6 +88,7 @@ main(int argc, char *argv[])
jsonrpc_close(client);
msg = reply_to_string(cmd_error, UNIXCTL_OUTPUT_FMT_TEXT, 0);
fputs(msg, stderr);
+ free(msg);
ovs_error(0, "%s: server returned an error", args->target);
exit(2);
}
@@ -111,11 +112,13 @@ main(int argc, char *argv[])
jsonrpc_close(client);
msg = reply_to_string(cmd_error, UNIXCTL_OUTPUT_FMT_TEXT, 0);
fputs(msg, stderr);
+ free(msg);
ovs_error(0, "%s: server returned an error", args->target);
exit(2);
} else if (cmd_result) {
msg = reply_to_string(cmd_result, args->format, args->format_flags);
fputs(msg, stdout);
+ free(msg);
} else {
OVS_NOT_REACHED();
}
@@ -124,7 +127,6 @@ main(int argc, char *argv[])
json_destroy(cmd_result);
json_destroy(cmd_error);
free(args);
- free(msg);
return 0;
}
From: Jakob Meng <code@jakobmeng.de> v12 has one tiny change compared to v11 [0]: It moves "free(msg);" up in order to work around an issue with AddressSanitizer/LeakSanitizer [1] in Ubuntu 22.04 which is not present in later releases. [0] https://patchwork.ozlabs.org/project/openvswitch/list/?series=407037&archive=both&state=* [1] https://github.com/ovsrobot/ovs/actions/runs/9110821443/job/25046630474 Best regards, Jakob Jakob Meng (6): Add global option for JSON output to ovs-appctl. python: Add option for JSON output to unixctl classes and appctl.py. appctl: Add option '--pretty' for pretty-printing JSON output. python: Add option for pretty-printing JSON output to appctl.py. vswitchd: Add JSON output for 'list-commands' command. ofproto: Add JSON output for 'dpif/show' command. Documentation/ref/ovs-appctl.8.rst | 19 +++ NEWS | 9 ++ lib/unixctl.c | 239 ++++++++++++++++++++++------- lib/unixctl.h | 20 ++- lib/util.c | 6 +- ofproto/ofproto-dpif.c | 120 +++++++++++++-- python/ovs/unixctl/client.py | 5 +- python/ovs/unixctl/server.py | 55 +++++-- python/ovs/util.py | 8 + tests/appctl.py | 40 ++++- tests/ovs-vswitchd.at | 29 ++++ tests/pmd.at | 23 +++ tests/unixctl-py.at | 8 + utilities/ovs-appctl.c | 154 ++++++++++++++++--- 14 files changed, 627 insertions(+), 108 deletions(-)