aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorcbdev <cb@cbcdn.com>2018-02-18 06:24:09 +0100
committercbdev <cb@cbcdn.com>2018-02-18 06:24:09 +0100
commit28544f9918dade92e27a5d6bd0fb771c91aa5815 (patch)
tree658cf779f839c400de1f1f5b9100c1dcb22c30b3
parent8874c3bff295f93f2012ae016d5d34270bdb1ebb (diff)
downloadmidimonster-28544f9918dade92e27a5d6bd0fb771c91aa5815.tar.gz
midimonster-28544f9918dade92e27a5d6bd0fb771c91aa5815.tar.bz2
midimonster-28544f9918dade92e27a5d6bd0fb771c91aa5815.zip
OSC backend error checking
-rw-r--r--osc.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/osc.c b/osc.c
index 40bc01c..018e040 100644
--- a/osc.c
+++ b/osc.c
@@ -501,17 +501,20 @@ static int backend_configure_instance(instance* inst, char* option, char* value)
}
static instance* backend_instance(){
- instance* i = mm_instance();
- osc_instance* data = calloc(1, sizeof(osc_instance));
- data->fd = -1;
+ instance* inst = mm_instance();
+ if(!inst){
+ return NULL;
+ }
- if(!i || !data){
+ osc_instance* data = calloc(1, sizeof(osc_instance));
+ if(!data){
fprintf(stderr, "Failed to allocate memory\n");
return NULL;
}
- i->impl = data;
- return i;
+ data->fd = -1;
+ inst->impl = data;
+ return inst;
}
static channel* backend_channel(instance* inst, char* spec){