+ free(sock);
+}
+
+/*
+ * Allocate and return a relayd socket object using a given URI to initialize
+ * it and the major/minor version of the supported protocol.
+ *
+ * On error, NULL is returned.
+ */
+LTTNG_HIDDEN
+struct lttcomm_relayd_sock *lttcomm_alloc_relayd_sock(struct lttng_uri *uri,
+ uint32_t major, uint32_t minor)
+{
+ int ret;
+ struct lttcomm_sock *tmp_sock = NULL;
+ struct lttcomm_relayd_sock *rsock = NULL;
+
+ assert(uri);
+
+ rsock = zmalloc(sizeof(*rsock));
+ if (!rsock) {
+ PERROR("zmalloc relayd sock");
+ goto error;