aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend.c
diff options
context:
space:
mode:
Diffstat (limited to 'backend.c')
-rw-r--r--backend.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/backend.c b/backend.c
index f49bd91..2eb6fcf 100644
--- a/backend.c
+++ b/backend.c
@@ -9,7 +9,7 @@ static instance** instances = NULL;
static size_t nchannels = 0;
static channel** channels = NULL;
-channel* mm_channel(instance* i, uint64_t ident){
+channel* mm_channel(instance* i, uint64_t ident, uint8_t create){
size_t u;
for(u = 0; u < nchannels; u++){
if(channels[u]->instance == 0 && channels[u]->ident == ident){
@@ -17,6 +17,10 @@ channel* mm_channel(instance* i, uint64_t ident){
}
}
+ if(!create){
+ return NULL;
+ }
+
channel** new_chan = realloc(channels, (nchannels + 1) * sizeof(channel*));
if(!new_chan){
fprintf(stderr, "Failed to allocate memory\n");