Fix: double put on error path
[lttng-tools.git] / src / bin / lttng-relayd / main.c
index 107ea14e113fe4ba500ab21c2229fe2ef375fd5e..7f091c2b792891f523a22aad61a60749869d8be1 100644 (file)
@@ -460,13 +460,14 @@ static int set_fd_pool_size(void)
                goto end;
        }
 
-       DBG("File descriptor count limits are %lu (soft) and %lu (hard)",
-                       rlimit.rlim_cur, rlimit.rlim_max);
+       DBG("File descriptor count limits are %" PRIu64 " (soft) and %" PRIu64 " (hard)",
+                       (uint64_t) rlimit.rlim_cur, (uint64_t) rlimit.rlim_max);
        if (lttng_opt_fd_pool_size == -1) {
                /* Use default value (soft limit - reserve). */
                if (rlimit.rlim_cur < DEFAULT_RELAYD_MIN_FD_POOL_SIZE) {
-                       ERR("The process' file number limit is too low (%lu). The process' file number limit must be set to at least %i.",
-                                       rlimit.rlim_cur, DEFAULT_RELAYD_MIN_FD_POOL_SIZE);
+                       ERR("The process' file number limit is too low (%" PRIu64 "). The process' file number limit must be set to at least %i.",
+                                       (uint64_t) rlimit.rlim_cur,
+                                       DEFAULT_RELAYD_MIN_FD_POOL_SIZE);
                        ret = -1;
                        goto end;
                }
@@ -2285,8 +2286,13 @@ static int relay_recv_index(const struct lttcomm_relayd_hdr *recv_hdr,
                /* no flush. */
                ret = 0;
        } else {
+               /*
+                * ret < 0
+                *
+                * relay_index_try_flush is responsible for the self-reference
+                * put of the index object on error.
+                */
                ERR("relay_index_try_flush error %d", ret);
-               relay_index_put(index);
                ret = -1;
        }
 
@@ -2690,9 +2696,13 @@ static int handle_index_data(struct relay_stream *stream, uint64_t net_seq_num,
                /* No flush. */
                ret = 0;
        } else {
-               /* Put self-ref for this index due to error. */
-               relay_index_put(index);
-               index = NULL;
+               /*
+                * ret < 0
+                *
+                * relay_index_try_flush is responsible for the self-reference
+                * put of the index object on error.
+                */
+               ERR("relay_index_try_flush error %d", ret);
                ret = -1;
        }
 end:
This page took 0.030004 seconds and 5 git commands to generate.