summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--stream/stream.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/stream/stream.c b/stream/stream.c
index 4ee7f8b316..072e9d0a89 100644
--- a/stream/stream.c
+++ b/stream/stream.c
@@ -396,8 +396,7 @@ stream_t* new_memory_stream(unsigned char* data,int len){
if(len < 0)
return NULL;
- s=malloc(sizeof(stream_t)+len);
- memset(s,0,sizeof(stream_t));
+ s=calloc(1, sizeof(stream_t)+len);
s->fd=-1;
s->type=STREAMTYPE_MEMORY;
s->buf_pos=0; s->buf_len=len;
@@ -409,9 +408,8 @@ stream_t* new_memory_stream(unsigned char* data,int len){
}
stream_t* new_stream(int fd,int type){
- stream_t *s=malloc(sizeof(stream_t));
+ stream_t *s=calloc(1, sizeof(stream_t));
if(s==NULL) return NULL;
- memset(s,0,sizeof(stream_t));
#if HAVE_WINSOCK2_H
{