Skip to content

Commit

Permalink
[doc] Add a comment about memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalecki committed Mar 28, 2013
1 parent eadc9cb commit 46a7ef3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/env.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ void env_set(char*** env, char* name, char* value) {
(*env)[length + 1] = NULL;
}

/*
* This leaks. There's no way to free `(*env)[index]` because we can't tell
* if it was allocated or put on heap.
*/
pair = malloc(name_length + 1 + value_length + 1);
env__cat(pair, name, value);
(*env)[index] = pair;
Expand Down

0 comments on commit 46a7ef3

Please sign in to comment.