]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Check for NULL pointer not return code
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 8 Nov 2016 21:16:54 +0000 (16:16 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 8 Nov 2016 21:16:54 +0000 (16:16 -0500)
src/main/interpreter.c
src/main/process.c
src/main/radsniff.c
src/main/threads.c
src/modules/proto_bfd/proto_bfd.c
src/modules/rlm_radius_client/rlm_radius_client.c
src/modules/rlm_unbound/rlm_unbound.c

index a7507f33516862b365ab34df515cf2ebf9970eb1..69b5499ca03f5a50d91d38bce36fbcbcb91398c9 100644 (file)
@@ -1395,7 +1395,7 @@ int unlang_event_fd_readable_add(REQUEST *request, fr_unlang_fd_callback_t callb
        ev->inst = module_instance;
        ev->ctx = ctx;
 
-       if (fr_event_fd_insert(request->el, fd, unlang_event_fd_handler, NULL, NULL, ev) < 0) {
+       if (!fr_event_fd_insert(request->el, fd, unlang_event_fd_handler, NULL, NULL, ev)) {
                talloc_free(ev);
                return -1;
        }
index 11de5b4b71a1e563c7111106110a2328a034085e..97fbd344406ed03733337330a7b9a3587dbe80c3 100644 (file)
@@ -4886,7 +4886,7 @@ static int event_new_fd(rad_listen_t *this)
                /*
                 *      All sockets: add the FD to the event handler.
                 */
-               if (fr_event_fd_insert(el, this->fd, event_socket_handler, NULL, NULL, this) < 0) {
+               if (!fr_event_fd_insert(el, this->fd, event_socket_handler, NULL, NULL, this)) {
                        ERROR("Failed adding event handler for socket: %s", fr_strerror());
                        fr_exit(1);
                }
@@ -5391,7 +5391,7 @@ int radius_event_start(bool have_children)
        }
        DEBUG4("Created signal pipe.  Read end FD %i, write end FD %i", self_pipe[0], self_pipe[1]);
 
-       if (fr_event_fd_insert(el, self_pipe[0], event_signal_handler, NULL, NULL, el) < 0) {
+       if (!fr_event_fd_insert(el, self_pipe[0], event_signal_handler, NULL, NULL, el)) {
                ERROR("Failed creating signal pipe handler: %s", fr_strerror());
                return -1;
        }
index 11e2d690bf163548fc66ab8cb8adbba62eaca75b..1af4f82861b8e31c5f2fd4a56c09aee39d32dbf4 100644 (file)
@@ -2800,7 +2800,7 @@ int main(int argc, char *argv[])
                        exit(EXIT_FAILURE);
                }
 
-               if (fr_event_fd_insert(events, self_pipe[0], rs_signal_action, NULL, NULL, events) < 0) {
+               if (!fr_event_fd_insert(events, self_pipe[0], rs_signal_action, NULL, NULL, events)) {
                        ERROR("Failed inserting signal pipe descriptor: %s", fr_strerror());
                        goto finish;
                }
@@ -2819,7 +2819,7 @@ int main(int argc, char *argv[])
                        event->out = out;
                        event->stats = stats;
 
-                       if (fr_event_fd_insert(events, in_p->fd, rs_got_packet, NULL, NULL, event) < 0) {
+                       if (!fr_event_fd_insert(events, in_p->fd, rs_got_packet, NULL, NULL, event)) {
                                ERROR("Failed inserting file descriptor");
                                goto finish;
                        }
index 13e4f4d10da84ae2bc04790b1a62ae69d26f4131..b3f7fc65006cf3c381e8715fd1946c14b550e1b6 100644 (file)
@@ -461,7 +461,7 @@ static void *thread_handler(void *arg)
        local_backlog = fr_heap_create(timestamp_cmp, offsetof(REQUEST, heap_id));
        rad_assert(local_backlog != NULL);
 
-       if (fr_event_fd_insert(el, thread->pipe_fd[0], thread_fd_handler, NULL, NULL, thread) < 0) {
+       if (!fr_event_fd_insert(el, thread->pipe_fd[0], thread_fd_handler, NULL, NULL, thread)) {
                ERROR("Failed inserting event for self");
                goto done;
        }
index 3d9d08538fb281e12db90ae15c3a18e11ae79087..fc4c151d46a57e0ea79a79964056c6ef7466ba1a 100644 (file)
@@ -332,7 +332,7 @@ static int bfd_pthread_create(bfd_state_t *session)
        fcntl(session->pipefd[1], F_SETFL, O_NONBLOCK | FD_CLOEXEC);
 #endif
 
-       if (fr_event_fd_insert(session->el, session->pipefd[0], bfd_pipe_recv, NULL, NULL, session) < 0) {
+       if (!fr_event_fd_insert(session->el, session->pipefd[0], bfd_pipe_recv, NULL, NULL, session)) {
                ERROR("Failed inserting file descriptor into event list: %s", fr_strerror());
                goto close_pipes;
        }
index 6c1cb2f88a4e1421662cf88efebc3950d1f94a8a..32d6791405a947504112a3db49af961ed3b4731a 100644 (file)
@@ -367,7 +367,7 @@ static int mod_fd_add(fr_event_list_t *el, rlm_radius_client_conn_t *conn, rlm_r
                return -1;
        }
 
-       if (fr_event_fd_insert(el, sockfd, mod_event_fd, NULL, NULL, conn) < 0) {
+       if (!fr_event_fd_insert(el, sockfd, mod_event_fd, NULL, NULL, conn)) {
                DEBUG("Failed adding event for socket: %s", fr_strerror());
                close(sockfd);
                return -1;
index c121593fad2e903ed596cc750fe9c2093d3bdee3..92d41800aa5531f611ad0ab5465e8949c103c9af 100644 (file)
@@ -625,7 +625,7 @@ static int mod_instantiate(CONF_SECTION *conf, void *instance)
 
        inst->log_fd = ub_fd(inst->ub);
        if (inst->log_fd >= 0) {
-               if (fr_event_fd_insert(inst->el, inst->log_fd, ub_fd_handler, NULL, NULL, inst) < 0) {
+               if (!fr_event_fd_insert(inst->el, inst->log_fd, ub_fd_handler, NULL, NULL, inst)) {
                        cf_log_err_cs(conf, "could not insert async fd");
                        inst->log_fd = -1;
                        goto error_nores;