aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorcbdev <cb@cbcdn.com>2018-03-19 13:43:51 +0100
committercbdev <cb@cbcdn.com>2018-03-19 13:43:51 +0100
commit0baabf2d6278254b0b1060ce72e40188b42f35e4 (patch)
treee76619071d0a617403075976c2ceeadb75492c1a
parenteabc4d0e07d2fb2f2a9aaf2571af490ec7e55b7d (diff)
downloadmidimonster-0baabf2d6278254b0b1060ce72e40188b42f35e4.tar.gz
midimonster-0baabf2d6278254b0b1060ce72e40188b42f35e4.tar.bz2
midimonster-0baabf2d6278254b0b1060ce72e40188b42f35e4.zip
Fix resource leaks on error, reported by Coverity Scan
-rw-r--r--backends/artnet.c1
-rw-r--r--backends/sacn.c2
-rw-r--r--plugin.c1
3 files changed, 4 insertions, 0 deletions
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;
}
diff --git a/plugin.c b/plugin.c
index 7b5e922..48db410 100644
--- a/plugin.c
+++ b/plugin.c
@@ -40,6 +40,7 @@ static int plugin_attach(char* path, char* file){
}
}
else{
+ dlclose(handle);
free(lib);
return 0;
}