From: Alan T. DeKok Date: Thu, 9 Sep 2021 14:27:24 +0000 (-0400) Subject: let's not leak FDs X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=31f6929cf76e999b0d0fc7272e99f1513f6dad81;p=thirdparty%2Ffreeradius-server.git let's not leak FDs --- diff --git a/src/lib/util/udp_queue.c b/src/lib/util/udp_queue.c index 08d2b96d459..1d48adab704 100644 --- a/src/lib/util/udp_queue.c +++ b/src/lib/util/udp_queue.c @@ -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,