summaryrefslogtreecommitdiffstats
path: root/libmpdemux/stream.c
diff options
context:
space:
mode:
Diffstat (limited to 'libmpdemux/stream.c')
-rw-r--r--libmpdemux/stream.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libmpdemux/stream.c b/libmpdemux/stream.c
index 052212bfe7..a7e348d7e5 100644
--- a/libmpdemux/stream.c
+++ b/libmpdemux/stream.c
@@ -354,7 +354,11 @@ int stream_control(stream_t *s, int cmd, void *arg){
}
stream_t* new_memory_stream(unsigned char* data,int len){
- stream_t *s=malloc(sizeof(stream_t)+len);
+ stream_t *s;
+
+ if(len < 0)
+ return NULL;
+ s=malloc(sizeof(stream_t)+len);
memset(s,0,sizeof(stream_t));
s->fd=-1;
s->type=STREAMTYPE_MEMORY;