Error checking for drmStrdup (Tilman Sauerbeck)

main
Adam Jackson 2005-11-29 20:02:34 +00:00
parent 7ede209ce0
commit 48198970ce
1 changed files with 10 additions and 5 deletions

View File

@ -164,12 +164,17 @@ void drmFree(void *pt)
/* drmStrdup can't use strdup(3), since it doesn't call _DRM_MALLOC... */
static char *drmStrdup(const char *s)
{
char *retval = NULL;
char *retval;
if (!s)
return NULL;
retval = _DRM_MALLOC(strlen(s)+1);
if (!retval)
return NULL;
strcpy(retval, s);
if (s) {
retval = _DRM_MALLOC(strlen(s)+1);
strcpy(retval, s);
}
return retval;
}