#include <lttng/lttng.h>
#include <lttng-sessiond-comm.h>
#include <lttngerr.h>
-#ifdef CONFIG_LTTNG_TOOLS_HAVE_UST
-#include <ust/lttng-ust-ctl.h>
-#include <ust/lttng-ust-abi.h>
-#else
-#include "lttng-ust-ctl.h"
-#include "lttng-ust-abi.h"
-#endif
#include "channel.h"
#include "hashtable.h"
chan = zmalloc(sizeof(struct lttng_channel));
if (chan == NULL) {
- perror("malloc channel init");
+ perror("zmalloc channel init");
goto error_alloc;
}
/*
cds_list_for_each_entry(uevent, &src->events.head, list) {
- new_uevent = malloc(sizeof(struct ltt_ust_event));
+ new_uevent = zmalloc(sizeof(struct ltt_ust_event));
if (new_uevent == NULL) {
- perror("malloc ltt_ust_event");
+ perror("zmalloc ltt_ust_event");
goto error;
}
* Create kernel channel of the kernel session and notify kernel thread.
*/
int channel_kernel_create(struct ltt_kernel_session *ksession,
- struct lttng_channel *chan, int kernel_pipe)
+ struct lttng_channel *attr, int kernel_pipe)
{
int ret;
- struct lttng_channel *attr = chan;
+ struct lttng_channel *defattr = NULL;
/* Creating channel attributes if needed */
if (attr == NULL) {
- /* FIXME: this appears to be a memory leak */
- attr = channel_new_default_attr(LTTNG_DOMAIN_KERNEL);
- if (attr == NULL) {
+ defattr = channel_new_default_attr(LTTNG_DOMAIN_KERNEL);
+ if (defattr == NULL) {
ret = LTTCOMM_FATAL;
goto error;
}
+ attr = defattr;
}
/* Channel not found, creating it */
}
ret = LTTCOMM_OK;
-
error:
+ free(defattr);
return ret;
}