summaryrefslogtreecommitdiffstats
path: root/lib/stream.c
diff options
context:
space:
mode:
authorpaul <paul>2004-12-22 01:15:34 +0100
committerpaul <paul>2004-12-22 01:15:34 +0100
commit0e43a2bcc0b044ec8e92108811c1341076938af9 (patch)
treeb57ec33d9184ddbd0bfcd5d41344300440428c69 /lib/stream.c
parent2004-12-21 Paul Jakma <paul.jakma@sun.com> (diff)
downloadfrr-0e43a2bcc0b044ec8e92108811c1341076938af9.tar.xz
frr-0e43a2bcc0b044ec8e92108811c1341076938af9.zip
2004-12-21 Paul Jakma <paul.jakma@sun.com>
* stream.c: Dont allocate streams with 0 sized data buffers
Diffstat (limited to 'lib/stream.c')
-rw-r--r--lib/stream.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/stream.c b/lib/stream.c
index 2d4de760b..1b85b130d 100644
--- a/lib/stream.c
+++ b/lib/stream.c
@@ -46,6 +46,11 @@ stream_new (size_t size)
{
struct stream *s;
+ assert (size > 0);
+
+ if (size == 0)
+ return NULL;
+
s = XCALLOC (MTYPE_STREAM, sizeof (struct stream));
s->data = XCALLOC (MTYPE_STREAM_DATA, size);