diff options
author | Jesper Eskilson <[email protected]> | 2018-05-22 11:14:19 +0200 |
---|---|---|
committer | Jesper Eskilson <[email protected]> | 2018-05-22 11:19:03 +0200 |
commit | abce739f6a897c462b3588ce15983eb530d7e080 (patch) | |
tree | 78d9ed799990372fb85a1ee64f9315397b065b35 /lib/erl_interface/src | |
parent | bbb3d151e6329d58b34e526fefb6964677d93104 (diff) | |
download | otp-abce739f6a897c462b3588ce15983eb530d7e080.tar.gz otp-abce739f6a897c462b3588ce15983eb530d7e080.tar.bz2 otp-abce739f6a897c462b3588ce15983eb530d7e080.zip |
ERL-629 Do not free() module buffer until it has been used
Diffstat (limited to 'lib/erl_interface/src')
-rw-r--r-- | lib/erl_interface/src/prog/erl_call.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/erl_interface/src/prog/erl_call.c b/lib/erl_interface/src/prog/erl_call.c index 7577a07a3e..66265b3e6a 100644 --- a/lib/erl_interface/src/prog/erl_call.c +++ b/lib/erl_interface/src/prog/erl_call.c @@ -517,6 +517,15 @@ int erl_call(int argc, char **argv) } } + + /* + * If we loaded any module source code, we can free the buffer + * now. This buffer was allocated in read_stdin(). + */ + if (module != NULL) { + free(module); + } + /* * Eval the Erlang functions read from stdin/ */ @@ -795,8 +804,6 @@ static int get_module(char **mbuf, char **mname) *mname = (char *) ei_chk_calloc(i+1, sizeof(char)); memcpy(*mname, start, i); } - if (*mbuf) - free(*mbuf); /* Allocated in read_stdin() */ return len; |