Fix deleteEnv null-pointer bug.
This commit is contained in:
parent
c0ad4481bd
commit
d73247a471
22
src/env.c
22
src/env.c
|
@ -180,17 +180,19 @@ void addFunc(const char *name, Object (*func)(Object, Object, struct Environment
|
||||||
|
|
||||||
void deleteEnv(struct Environment *e)
|
void deleteEnv(struct Environment *e)
|
||||||
{
|
{
|
||||||
int i = 0;
|
if (e->strings) {
|
||||||
while(e->strings[i]) {
|
int i = 0;
|
||||||
free(e->strings[i]);
|
while(e->strings[i]) {
|
||||||
cleanObject(&e->objects[i]);
|
free(e->strings[i]);
|
||||||
i++;
|
cleanObject(&e->objects[i]);
|
||||||
}
|
i++;
|
||||||
free(e->strings);
|
}
|
||||||
e->strings = NULL;
|
free(e->strings);
|
||||||
|
e->strings = NULL;
|
||||||
|
|
||||||
free(e->objects);
|
free(e->objects);
|
||||||
e->objects = NULL;
|
e->objects = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct symFunc {
|
struct symFunc {
|
||||||
|
|
Loading…
Reference in New Issue