]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
let's not leak FDs
authorAlan T. DeKok <aland@freeradius.org>
Thu, 9 Sep 2021 14:27:24 +0000 (10:27 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 9 Sep 2021 14:27:24 +0000 (10:27 -0400)
src/lib/util/udp_queue.c

index 08d2b96d459027dde993f265cd1da80f66b0dea9..1d48adab704b43b3e8c5ff1d7f1953df5a4eed1a 100644 (file)
@@ -65,6 +65,8 @@ static int _udp_queue_free(fr_udp_queue_t *uq)
                talloc_free(entry);
        }}
 
+       close(uq->fd);
+
        return 0;
 }
 
@@ -94,7 +96,10 @@ fr_udp_queue_t *fr_udp_queue_alloc(TALLOC_CTX *ctx, fr_udp_queue_config_t *confi
        if (fd < 0) return NULL;
 
        uq = talloc_zero(ctx, fr_udp_queue_t);
-       if (!uq) return NULL;
+       if (!uq) {
+               close(fd);
+               return NULL;
+       }
 
        *uq = (fr_udp_queue_t) {
                .config = config,