diff circbuffer.c @ 709:abd99ecd7ec2

use an empty writebuf rather than a NULL one
author Matt Johnston <matt@ucc.asn.au>
date Wed, 20 Mar 2013 22:31:07 +0800
parents 4222a1039b06
children c71df09bc610
line wrap: on
line diff
--- a/circbuffer.c	Wed Mar 20 00:05:19 2013 +0800
+++ b/circbuffer.c	Wed Mar 20 22:31:07 2013 +0800
@@ -37,7 +37,9 @@
 	}
 
 	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;