Correct known memory leaks.
This commit is contained in:
parent
011ed937fe
commit
13a7ad97b5
19
src/env.c
19
src/env.c
|
@ -74,9 +74,8 @@ struct Environment envForLambda(const Object* params, const Object* arg_forms,
|
|||
march = march->forward;
|
||||
}
|
||||
|
||||
while(outer) {
|
||||
if(outer) {
|
||||
outer->refs += 1;
|
||||
outer = outer->outer;
|
||||
}
|
||||
return env;
|
||||
}
|
||||
|
@ -196,13 +195,6 @@ void deleteEnv(struct Environment* e)
|
|||
deleteEnv(e->outer);
|
||||
}
|
||||
|
||||
for (int i = 0; i < e->structCount; i++) {
|
||||
free(e->structDefs[i].name);
|
||||
for (int j = 0; j < e->structDefs[i].fieldCount; j++) {
|
||||
free(e->structDefs[j].names);
|
||||
}
|
||||
}
|
||||
|
||||
if (e->strings) {
|
||||
int i = 0;
|
||||
while (e->strings[i]) {
|
||||
|
@ -212,10 +204,17 @@ void deleteEnv(struct Environment* e)
|
|||
}
|
||||
free(e->strings);
|
||||
e->strings = NULL;
|
||||
|
||||
free(e->objects);
|
||||
e->objects = NULL;
|
||||
}
|
||||
|
||||
for (int i = 0; i < e->structCount; i++) {
|
||||
free(e->structDefs[i].name);
|
||||
for (int j = 0; j < e->structDefs[i].fieldCount; j++) {
|
||||
free(e->structDefs[i].names[j]);
|
||||
}
|
||||
free(e->structDefs[i].names);
|
||||
}
|
||||
free(e->structDefs);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue