- ret = snprintf(ustream->pathname, PATH_MAX, "%s/%s_%lu",
- uchan->pathname, uchan->name,
- hashtable_get_count(ua_chan->streams));
- if (ret < 0) {
- PERROR("asprintf UST create stream");
- goto next_chan;
+ ustream = malloc(sizeof(*ustream));
+ if (ustream == NULL) {
+ goto next_chan;
+ }
+ memset(ustream, 0, sizeof(struct ltt_ust_stream));
+ ustream->obj = obj;
+ ustream->handle = ustream->obj->handle;
+ hashtable_node_init(&ustream->node,
+ (void *)((unsigned long) ustream->handle), sizeof(void *));
+ hashtable_add_unique(ua_chan->streams, &ustream->node);
+ ret = snprintf(ustream->pathname, PATH_MAX, "%s/%s_%lu",
+ uchan->pathname, uchan->name,
+ hashtable_get_count(ua_chan->streams) - 1);
+ if (ret < 0) {
+ PERROR("asprintf UST create stream");
+ goto next_chan;
+ }