g_free() is not enough here: the `url` member is not freed on error.
Just destroy the whole connection object cleanly.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I98184be066a9155e08d792d55fc4b8489a15bb30
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1946
Tested-by: jenkins <jenkins@lttng.org>
error_report:
BT_COMP_LOGW("Failure to establish connection to url \"%s\"", url);
error:
error_report:
BT_COMP_LOGW("Failure to establish connection to url \"%s\"", url);
error:
- g_free(viewer_connection);
+ if (viewer_connection) {
+ live_viewer_connection_destroy(viewer_connection);
+ }
+
{
BT_COMP_LOGI("Closing connection to url \"%s\"", viewer_connection->url->str);
lttng_live_disconnect_viewer(viewer_connection);
{
BT_COMP_LOGI("Closing connection to url \"%s\"", viewer_connection->url->str);
lttng_live_disconnect_viewer(viewer_connection);
- g_string_free(viewer_connection->url, true);
+ if (viewer_connection->url) {
+ g_string_free(viewer_connection->url, true);
+ }
if (viewer_connection->relay_hostname) {
g_string_free(viewer_connection->relay_hostname, true);
}
if (viewer_connection->relay_hostname) {
g_string_free(viewer_connection->relay_hostname, true);
}