&uiter)) != -ENOENT) {
health_code_update(&health_thread_cmd);
if (count >= nbmem) {
+ /* In case the realloc fails, we free the memory */
+ void *tmp_ptr = (void *) tmp;
DBG2("Reallocating event list from %zu to %zu entries", nbmem,
2 * nbmem);
nbmem *= 2;
tmp = realloc(tmp, nbmem * sizeof(struct lttng_event));
if (tmp == NULL) {
PERROR("realloc ust app events");
+ free(tmp_ptr);
ret = -ENOMEM;
goto rcu_error;
}
&uiter)) != -ENOENT) {
health_code_update(&health_thread_cmd);
if (count >= nbmem) {
+ /* In case the realloc fails, we free the memory */
+ void *tmp_ptr = (void *) tmp;
DBG2("Reallocating event field list from %zu to %zu entries", nbmem,
2 * nbmem);
nbmem *= 2;
tmp = realloc(tmp, nbmem * sizeof(struct lttng_event_field));
if (tmp == NULL) {
PERROR("realloc ust app event fields");
+ free(tmp_ptr);
ret = -ENOMEM;
goto rcu_error;
}
memcpy(tmp[count].field_name, uiter.field_name, LTTNG_UST_SYM_NAME_LEN);
tmp[count].type = uiter.type;
- tmp[count].written = uiter.written;
+ tmp[count].nowrite = uiter.nowrite;
memcpy(tmp[count].event.name, uiter.event_name, LTTNG_UST_SYM_NAME_LEN);
tmp[count].event.loglevel = uiter.loglevel;
/* Order is important */
cds_list_add_tail(&ustream->list, &ua_chan->streams.head);
ret = snprintf(ustream->name, sizeof(ustream->name), "%s_%u",
- ua_chan->name, ua_chan->streams.count++);
+ ua_chan->name, ua_chan->streams.count);
+ ua_chan->streams.count++;
if (ret < 0) {
PERROR("asprintf UST create stream");
/*