make av_strdup(NULL) return NULL

Originally committed as revision 13250 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Michael Niedermayer 2008-05-23 12:37:32 +00:00
parent 30897e764a
commit fdf35f265a

View File

@ -139,11 +139,13 @@ void *av_mallocz(unsigned int size)
char *av_strdup(const char *s)
{
char *ptr;
char *ptr= NULL;
if(s){
int len = strlen(s) + 1;
ptr = av_malloc(len);
if (ptr)
memcpy(ptr, s, len);
}
return ptr;
}