Don't access free memory after unloading a module. Bugzilla #4168.
This commit is contained in:
parent
79dc689261
commit
a715634d23
|
@ -1,3 +1,9 @@
|
||||||
|
2006-04-23 Matthieu Herrb <matthieu.herrb@laas.fr>
|
||||||
|
* hw/xfree86/dummylib/xalloc.c
|
||||||
|
* hw/xfree86/loader/loader.c\
|
||||||
|
Don't access free memory after unloading a module.
|
||||||
|
Bugzilla #4168.
|
||||||
|
|
||||||
2006-04-22 Benjamin Herrenschmidt <benh@kernel.crashing.org>
|
2006-04-22 Benjamin Herrenschmidt <benh@kernel.crashing.org>
|
||||||
|
|
||||||
* hw/xfree86/os-support/linux/lnx_KbdMap.c:
|
* hw/xfree86/os-support/linux/lnx_KbdMap.c:
|
||||||
|
|
|
@ -94,3 +94,19 @@ Xstrdup(const char *s)
|
||||||
strcpy(sd, s);
|
strcpy(sd, s);
|
||||||
return sd;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -818,7 +818,9 @@ static void
|
||||||
AppendSymbol(symlist * list, const char *sym)
|
AppendSymbol(symlist * list, const char *sym)
|
||||||
{
|
{
|
||||||
list->list = xnfrealloc(list->list, (list->num + 1) * sizeof(char **));
|
list->list = xnfrealloc(list->list, (list->num + 1) * sizeof(char **));
|
||||||
list->list[list->num] = sym;
|
/* copy the symbol, since it comes from a module
|
||||||
|
that can be unloaded later */
|
||||||
|
list->list[list->num] = xnfstrdup(sym);
|
||||||
list->num++;
|
list->num++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue