summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
0c3cd7e)
Found by Coverity:
** CID
1136987: Resource leak (RESOURCE_LEAK)
/formats/lttng-live/lttng-live-functions.c: 372 in lttng_live_attach_session()
/formats/lttng-live/lttng-live-functions.c: 386 in lttng_live_attach_session()
/formats/lttng-live/lttng-live-functions.c: 383 in lttng_live_attach_session()
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
char *path;
path = strdup(LTTNG_METADATA_PATH_TEMPLATE);
char *path;
path = strdup(LTTNG_METADATA_PATH_TEMPLATE);
+ if (!path) {
+ perror("strdup");
+ ret = -1;
+ goto error;
+ }
+ if (!mkdtemp(path)) {
+ perror("mkdtemp");
+ free(path);
+ ret = -1;
+ goto error;
+ }
ctx->session->streams[i].metadata_flag = 1;
snprintf(ctx->session->streams[i].path,
sizeof(ctx->session->streams[i].path),
ctx->session->streams[i].metadata_flag = 1;
snprintf(ctx->session->streams[i].path,
sizeof(ctx->session->streams[i].path),
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
if (ret < 0) {
perror("open");
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
if (ret < 0) {
perror("open");
goto error;
}
ctx->session->streams[i].fd = ret;
goto error;
}
ctx->session->streams[i].fd = ret;
}
ret = lttng_live_ctf_trace_assign(&ctx->session->streams[i],
be64toh(stream.ctf_trace_id));
}
ret = lttng_live_ctf_trace_assign(&ctx->session->streams[i],
be64toh(stream.ctf_trace_id));