summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorpaul <paul>2004-12-22 00:15:34 +0000
committerpaul <paul>2004-12-22 00:15:34 +0000
commit0e43a2bcc0b044ec8e92108811c1341076938af9 (patch)
treeb57ec33d9184ddbd0bfcd5d41344300440428c69 /lib
parent4ba9b9247222a6031a8060ddd39bfb19d90624e8 (diff)
2004-12-21 Paul Jakma <paul.jakma@sun.com>
* stream.c: Dont allocate streams with 0 sized data buffers
Diffstat (limited to 'lib')
-rw-r--r--lib/ChangeLog1
-rw-r--r--lib/stream.c5
2 files changed, 6 insertions, 0 deletions
diff --git a/lib/ChangeLog b/lib/ChangeLog
index 065cddd0..07eb21d1 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -2,6 +2,7 @@
* if.h: Add more 'non-generic' IFF_ flags.
* if.c: IFF_NOXMIT/IFF_VIRTUAL interfaces are 'loopback like'
+ * stream.c: Dont allocate streams with 0 sized data buffers
2004-12-17 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
diff --git a/lib/stream.c b/lib/stream.c
index 2d4de760..1b85b130 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);