comparison utils.c @ 908:2ac4caad5ca6 libavcodec

print a warning if something allocates 0 bytes
author michaelni
date Wed, 04 Dec 2002 12:42:25 +0000
parents 22ee74da2cd3
children 3814e9115672
comparison
equal deleted inserted replaced
907:b3ae2aba4b24 908:2ac4caad5ca6
21 #include "mpegvideo.h" 21 #include "mpegvideo.h"
22 22
23 void *av_mallocz(unsigned int size) 23 void *av_mallocz(unsigned int size)
24 { 24 {
25 void *ptr; 25 void *ptr;
26
27 if(size == 0) fprintf(stderr, "Warning, allocating 0 bytes\n");
28
26 ptr = av_malloc(size); 29 ptr = av_malloc(size);
27 if (!ptr) 30 if (!ptr)
28 return NULL; 31 return NULL;
29 memset(ptr, 0, size); 32 memset(ptr, 0, size);
30 return ptr; 33 return ptr;