error_buf);
goto end;
}
- viewer_connection->proto = lttng_live_url_parts.proto;
+ viewer_connection->proto.reset(lttng_live_url_parts.proto);
lttng_live_url_parts.proto = NULL;
- viewer_connection->relay_hostname = lttng_live_url_parts.hostname;
+ viewer_connection->relay_hostname.reset(lttng_live_url_parts.hostname);
lttng_live_url_parts.hostname = NULL;
if (lttng_live_url_parts.port >= 0) {
viewer_connection->port = LTTNG_DEFAULT_NETWORK_VIEWER_PORT;
}
- viewer_connection->target_hostname = lttng_live_url_parts.target_hostname;
+ viewer_connection->target_hostname.reset(lttng_live_url_parts.target_hostname);
lttng_live_url_parts.target_hostname = NULL;
if (lttng_live_url_parts.session_name) {
- viewer_connection->session_name = lttng_live_url_parts.session_name;
+ viewer_connection->session_name.reset(lttng_live_url_parts.session_name);
lttng_live_url_parts.session_name = NULL;
}
lttng_live_disconnect_viewer(viewer_connection);
- if (viewer_connection->relay_hostname) {
- g_string_free(viewer_connection->relay_hostname, true);
- }
-
- if (viewer_connection->target_hostname) {
- g_string_free(viewer_connection->target_hostname, true);
- }
-
- if (viewer_connection->session_name) {
- g_string_free(viewer_connection->session_name, true);
- }
-
- if (viewer_connection->proto) {
- g_string_free(viewer_connection->proto, true);
- }
-
delete viewer_connection;
bt_socket_fini();
#include <babeltrace2/babeltrace.h>
#include "compat/socket.hpp"
+#include "cpp-common/bt2c/glib-up.hpp"
#include "cpp-common/bt2c/logging.hpp"
#define LTTNG_DEFAULT_NETWORK_VIEWER_PORT 5344
std::string url;
- GString *relay_hostname = nullptr;
- GString *target_hostname = nullptr;
- GString *session_name = nullptr;
- GString *proto = nullptr;
+ bt2c::GStringUP relay_hostname;
+ bt2c::GStringUP target_hostname;
+ bt2c::GStringUP session_name;
+ bt2c::GStringUP proto;
BT_SOCKET control_sock {};
int port = 0;