aboutsummaryrefslogtreecommitdiffhomepage
path: root/backends
diff options
context:
space:
mode:
authorcbdev <cb@cbcdn.com>2018-03-16 01:18:35 +0100
committercbdev <cb@cbcdn.com>2018-03-16 01:18:35 +0100
commiteabc4d0e07d2fb2f2a9aaf2571af490ec7e55b7d (patch)
treeeb3ee0aa6178e10d2ddef38f2921fa63d09a1fd2 /backends
parent5df6379df17fd7875e54ef7c5b5d07c5edb95644 (diff)
downloadmidimonster-eabc4d0e07d2fb2f2a9aaf2571af490ec7e55b7d.tar.gz
midimonster-eabc4d0e07d2fb2f2a9aaf2571af490ec7e55b7d.tar.bz2
midimonster-eabc4d0e07d2fb2f2a9aaf2571af490ec7e55b7d.zip
Fix issues found by Coverity Scan
Diffstat (limited to 'backends')
-rw-r--r--backends/artnet.c1
-rw-r--r--backends/evdev.c1
-rw-r--r--backends/osc.c7
3 files changed, 7 insertions, 2 deletions
diff --git a/backends/artnet.c b/backends/artnet.c
index d167dec..f98ae96 100644
--- a/backends/artnet.c
+++ b/backends/artnet.c
@@ -489,6 +489,7 @@ static int artnet_start(){
}
if(!artnet_fds){
+ free(inst);
fprintf(stderr, "Failed to start ArtNet backend: no descriptors bound\n");
return 1;
}
diff --git a/backends/evdev.c b/backends/evdev.c
index e26eb76..979698f 100644
--- a/backends/evdev.c
+++ b/backends/evdev.c
@@ -359,6 +359,7 @@ static int evdev_start(){
if(data->output_enabled){
if(libevdev_uinput_create_from_device(data->output_proto, LIBEVDEV_UINPUT_OPEN_MANAGED, &data->output_ev)){
fprintf(stderr, "Failed to create evdev output device: %s\n", strerror(errno));
+ free(inst);
return 1;
}
fprintf(stderr, "Created device node %s for instance %s\n", libevdev_uinput_get_devnode(data->output_ev), inst[u]->name);
diff --git a/backends/osc.c b/backends/osc.c
index adc91f5..5f94ec2 100644
--- a/backends/osc.c
+++ b/backends/osc.c
@@ -334,6 +334,7 @@ static int osc_listener(char* host, char* port){
//set nonblocking
flags = fcntl(fd, F_GETFL, 0);
if(fcntl(fd, F_SETFL, flags | O_NONBLOCK) < 0){
+ close(fd);
fprintf(stderr, "Failed to set OSC descriptor nonblocking\n");
return -1;
}
@@ -697,7 +698,7 @@ static int backend_handle(size_t num, managed_fd* fds){
else{
bytes_read = recv(fds[fd].fd, recv_buf, sizeof(recv_buf), 0);
}
- if(data->root && strncmp(recv_buf, data->root, strlen(data->root))){
+ if(data->root && strncmp(recv_buf, data->root, min(bytes_read, strlen(data->root)))){
//ignore packet for different root
continue;
}
@@ -802,7 +803,9 @@ static int backend_shutdown(){
}
free(data->channel);
free(data->root);
- close(data->fd);
+ if(data->fd >= 0){
+ close(data->fd);
+ }
data->fd = -1;
data->channels = 0;
free(inst[u]->impl);