diff options
Diffstat (limited to 'backend.c')
-rw-r--r-- | backend.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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"); |