aboutsummaryrefslogtreecommitdiffhomepage
path: root/backends
diff options
context:
space:
mode:
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);