/* Allocate a new ltt ust session */
lus = malloc(sizeof(struct ltt_ust_session));
if (lus == NULL) {
- perror("create ust session malloc");
+ PERROR("create ust session malloc");
goto error;
}
/* Init data structure */
lus->consumer_fds_sent = 0;
lus->uid = uid;
+ lus->start_trace = 0;
/* Alloc UST domain hash tables */
lus->domain_pid = hashtable_new(0);
ret = snprintf(lus->pathname, PATH_MAX, "%s/ust", path);
if (ret < 0) {
PERROR("snprintf kernel traces path");
- goto error;
+ goto error_free_session;
}
DBG2("UST trace session create successful");
return lus;
+error_free_session:
+ free(lus);
error:
return NULL;
}
ret = snprintf(luc->pathname, PATH_MAX, "%s", path);
if (ret < 0) {
perror("asprintf ust create channel");
- goto error;
+ goto error_free_channel;
}
DBG2("Trace UST channel %s created", luc->name);
return luc;
+error_free_channel:
+ free(luc);
error:
return NULL;
}
break;
default:
ERR("Unknown ust instrumentation type (%d)", ev->type);
- goto error;
+ goto error_free_event;
}
/* Copy event name */
hashtable_node_init(&lue->node, (void *) lue->attr.name,
strlen(lue->attr.name));
/* Alloc context hash tables */
- lue->ctx = hashtable_new_str(5);
+ lue->ctx = hashtable_new_str(0);
return lue;
+error_free_event:
+ free(lue);
error:
return NULL;
}
ret = snprintf(lum->pathname, PATH_MAX, "%s/metadata", path);
if (ret < 0) {
perror("asprintf ust metadata");
- goto error;
+ goto error_free_metadata;
}
return lum;
+error_free_metadata:
+ free(lum);
error:
return NULL;
}