Fix acpi_avoid() to call freeenv() on the original char * returned from

getenv().

Reported by:	joe
Tested by:	joe
This commit is contained in:
John Baldwin 2002-05-09 21:13:37 +00:00
parent 6bc913d9ee
commit 3c600cfb6c

View File

@ -1556,16 +1556,17 @@ acpi_name(ACPI_HANDLE handle)
int
acpi_avoid(ACPI_HANDLE handle)
{
char *cp, *np;
char *cp, *env, *np;
int len;
np = acpi_name(handle);
if (*np == '\\')
np++;
if ((cp = getenv("debug.acpi.avoid")) == NULL)
if ((env = getenv("debug.acpi.avoid")) == NULL)
return(0);
/* scan the avoid list checking for a match */
cp = env;
for (;;) {
while ((*cp != 0) && isspace(*cp))
cp++;
@ -1575,12 +1576,12 @@ acpi_avoid(ACPI_HANDLE handle)
while ((cp[len] != 0) && !isspace(cp[len]))
len++;
if (!strncmp(cp, np, len)) {
freeenv(cp);
freeenv(env);
return(1);
}
cp += len;
}
freeenv(cp);
freeenv(env);
return(0);
}