diff options
Diffstat (limited to 'circbuffer.c')
-rw-r--r-- | circbuffer.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/circbuffer.c b/circbuffer.c index 7953737..55c4422 100644 --- a/circbuffer.c +++ b/circbuffer.c @@ -37,7 +37,9 @@ circbuffer * cbuf_new(unsigned int size) { } cbuf = (circbuffer*)m_malloc(sizeof(circbuffer)); - cbuf->data = (unsigned char*)m_malloc(size); + if (size > 0) { + cbuf->data = (unsigned char*)m_malloc(size); + } cbuf->used = 0; cbuf->readpos = 0; cbuf->writepos = 0; |