Skip to content

Commit

Permalink
make av_strdup(NULL) return NULL
Browse files Browse the repository at this point in the history
Originally committed as revision 13250 to svn://svn.ffmpeg.org/ffmpeg/trunk
  • Loading branch information
michaelni committed May 23, 2008
1 parent 30897e7 commit fdf35f2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion libavutil/mem.c
Expand Up @@ -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;
}

0 comments on commit fdf35f2

Please sign in to comment.