projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: Uninitialized pointer read
[lttng-tools.git]
/
src
/
bin
/
lttng-sessiond
/
main.c
diff --git
a/src/bin/lttng-sessiond/main.c
b/src/bin/lttng-sessiond/main.c
index 445485b417d5d0b0e0cd6f1de4eaab41336baaf5..efaaf4ffa99f40c5cc0dac877e796a7eda86e5ea 100644
(file)
--- a/
src/bin/lttng-sessiond/main.c
+++ b/
src/bin/lttng-sessiond/main.c
@@
-232,6
+232,9
@@
static enum consumerd_state kernel_consumerd_state;
*/
static int app_socket_timeout;
*/
static int app_socket_timeout;
+/* Set in main() with the current page size. */
+long page_size;
+
static
void setup_consumerd_path(void)
{
static
void setup_consumerd_path(void)
{
@@
-2892,6
+2895,7
@@
skip_domain:
ret = setup_lttng_msg(cmd_ctx, nb_dom * sizeof(struct lttng_domain));
if (ret < 0) {
ret = setup_lttng_msg(cmd_ctx, nb_dom * sizeof(struct lttng_domain));
if (ret < 0) {
+ free(domains);
goto setup_error;
}
goto setup_error;
}
@@
-2919,6
+2923,7
@@
skip_domain:
ret = setup_lttng_msg(cmd_ctx, nb_chan * sizeof(struct lttng_channel));
if (ret < 0) {
ret = setup_lttng_msg(cmd_ctx, nb_chan * sizeof(struct lttng_channel));
if (ret < 0) {
+ free(channels);
goto setup_error;
}
goto setup_error;
}
@@
-2946,6
+2951,7
@@
skip_domain:
ret = setup_lttng_msg(cmd_ctx, nb_event * sizeof(struct lttng_event));
if (ret < 0) {
ret = setup_lttng_msg(cmd_ctx, nb_event * sizeof(struct lttng_event));
if (ret < 0) {
+ free(events);
goto setup_error;
}
goto setup_error;
}
@@
-3091,6
+3097,10
@@
static void *thread_manage_health(void *data)
rcu_register_thread();
rcu_register_thread();
+ /* We might hit an error path before this is set once. */
+ memset(&events, 0, sizeof(events));
+ events.epfd = -1;
+
/* Create unix socket */
sock = lttcomm_create_unix_sock(health_unix_sock_path);
if (sock < 0) {
/* Create unix socket */
sock = lttcomm_create_unix_sock(health_unix_sock_path);
if (sock < 0) {
@@
-3443,13
+3453,11
@@
static void *thread_manage_clients(void *data)
ret = process_client_msg(cmd_ctx, sock, &sock_error);
rcu_thread_offline();
if (ret < 0) {
ret = process_client_msg(cmd_ctx, sock, &sock_error);
rcu_thread_offline();
if (ret < 0) {
- if (sock_error) {
- ret = close(sock);
- if (ret) {
- PERROR("close");
- }
- sock = -1;
+ ret = close(sock);
+ if (ret) {
+ PERROR("close");
}
}
+ sock = -1;
/*
* TODO: Inform client somehow of the fatal error. At
* this point, ret < 0 means that a zmalloc failed
/*
* TODO: Inform client somehow of the fatal error. At
* this point, ret < 0 means that a zmalloc failed
@@
-4038,6
+4046,13
@@
int main(int argc, char **argv)
setup_consumerd_path();
setup_consumerd_path();
+ page_size = sysconf(_SC_PAGESIZE);
+ if (page_size < 0) {
+ PERROR("sysconf _SC_PAGESIZE");
+ page_size = LONG_MAX;
+ WARN("Fallback page size to %ld", page_size);
+ }
+
/* Parse arguments */
progname = argv[0];
if ((ret = parse_args(argc, argv)) < 0) {
/* Parse arguments */
progname = argv[0];
if ((ret = parse_args(argc, argv)) < 0) {
This page took
0.031104 seconds
and
5
git commands to generate.