aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2019-03-15 17:45:58 +0100
committerMicael Karlberg <[email protected]>2019-03-15 17:48:30 +0100
commit229ea2a49ac5fe072023f75ed2094dba28f4c86b (patch)
tree3d1df87a3e0e5a13d3a427f5cc1f6553b54cb0c1
parentbb522c71838f8b46425f4156ee2ed58d155e13b5 (diff)
downloadotp-229ea2a49ac5fe072023f75ed2094dba28f4c86b.tar.gz
otp-229ea2a49ac5fe072023f75ed2094dba28f4c86b.tar.bz2
otp-229ea2a49ac5fe072023f75ed2094dba28f4c86b.zip
[net] Fixed memory leak in address info encoding
Fixed a memory leak in the function for address infos encoding.
-rw-r--r--erts/emulator/nifs/common/net_nif.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/erts/emulator/nifs/common/net_nif.c b/erts/emulator/nifs/common/net_nif.c
index 6c91bd74bd..252aa3c835 100644
--- a/erts/emulator/nifs/common/net_nif.c
+++ b/erts/emulator/nifs/common/net_nif.c
@@ -1363,7 +1363,7 @@ ERL_NIF_TERM encode_address_infos(ErlNifEnv* env,
NDBG( ("NET", "encode_address_infos -> len: %d\r\n", len) );
if (len > 0) {
- ERL_NIF_TERM* array = MALLOC(len * sizeof(ERL_NIF_TERM)); // LEAK?
+ ERL_NIF_TERM* array = MALLOC(len * sizeof(ERL_NIF_TERM));
unsigned int i = 0;
struct addrinfo* p = addrInfo;
@@ -1374,6 +1374,7 @@ ERL_NIF_TERM encode_address_infos(ErlNifEnv* env,
}
result = MKLA(env, array, len);
+ FREE(array);
} else {
result = MKEL(env);
}