fix memory leaks

This commit is contained in:
Chris Cromer 2021-07-17 20:55:06 -04:00
parent a41e25b12a
commit 94a32f28f6

View File

@ -218,6 +218,10 @@ void echo(StringArray *args) {
}
fprintf(stdout, "%s", value);
}
if (variable != NULL) {
free(variable);
variable = NULL;
}
}
else {
if (i != 1) {
@ -236,4 +240,5 @@ void echo(StringArray *args) {
}
fprintf(stderr, "The variable %s doesn't exist!\n", no_variables->array[i]);
}
free_string_array(no_variables);
}