Don't access free memory after unloading a module. Bugzilla #4168.

This commit is contained in:
Matthieu Herrb 2006-04-23 13:14:50 +00:00
commit a715634d23
3 changed files with 25 additions and 1 deletions

View file

@ -94,3 +94,19 @@ Xstrdup(const char *s)
strcpy(sd, s);
return sd;
}
char *
XNFstrdup(const char *s)
{
char *sd;
size_t len;
if (s == NULL)
return NULL;
len = strlen(s) + 1;
sd = (char *)XNFalloc(len);
strlcpy(sd, s, len);
return sd;
}