From 0baabf2d6278254b0b1060ce72e40188b42f35e4 Mon Sep 17 00:00:00 2001 From: cbdev Date: Mon, 19 Mar 2018 13:43:51 +0100 Subject: Fix resource leaks on error, reported by Coverity Scan --- backends/artnet.c | 1 + backends/sacn.c | 2 ++ 2 files changed, 3 insertions(+) (limited to 'backends') diff --git a/backends/artnet.c b/backends/artnet.c index f98ae96..d9ebfe5 100644 --- a/backends/artnet.c +++ b/backends/artnet.c @@ -77,6 +77,7 @@ static int artnet_listener(char* host, char* port){ flags = fcntl(fd, F_GETFL, 0); if(fcntl(fd, F_SETFL, flags | O_NONBLOCK) < 0){ fprintf(stderr, "Failed to set ArtNet descriptor nonblocking\n"); + close(fd); return -1; } diff --git a/backends/sacn.c b/backends/sacn.c index 57ac789..7fc7a59 100644 --- a/backends/sacn.c +++ b/backends/sacn.c @@ -111,6 +111,7 @@ static int sacn_listener(char* host, char* port, uint8_t fd_flags){ flags = fcntl(fd, F_GETFL, 0); if(fcntl(fd, F_SETFL, flags | O_NONBLOCK) < 0){ fprintf(stderr, "Failed to set sACN descriptor nonblocking\n"); + close(fd); return -1; } @@ -641,6 +642,7 @@ static int sacn_start(){ if(!global_cfg.fds){ fprintf(stderr, "Failed to start sACN backend: no descriptors bound\n"); + free(inst); return 1; } -- cgit v1.2.3