aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrik Nyblom <pan@erlang.org>2010-09-03 10:36:11 +0200
committerPatrik Nyblom <pan@erlang.org>2010-09-06 11:00:14 +0200
commit144e2cec31e2ac1bad6ee6b0afc2a847f380127f (patch)
treef66cac056a9bbb795289b7b8f6c1fa7a070b160b
parentac64f33f2baf717ce77337069d434d25c37d46cf (diff)
downloadotp-144e2cec31e2ac1bad6ee6b0afc2a847f380127f.tar.gz
otp-144e2cec31e2ac1bad6ee6b0afc2a847f380127f.tar.bz2
otp-144e2cec31e2ac1bad6ee6b0afc2a847f380127f.zip
Stop leaking memory in nif_SUITE:send* testcases
The make_term_n function in nif_SUITE.c created resources that never got released, creating valgrind memcheck Definitely Lost warnings.
-rw-r--r--erts/emulator/test/nif_SUITE_data/nif_SUITE.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/erts/emulator/test/nif_SUITE_data/nif_SUITE.c b/erts/emulator/test/nif_SUITE_data/nif_SUITE.c
index 5384a32f21..8489124966 100644
--- a/erts/emulator/test/nif_SUITE_data/nif_SUITE.c
+++ b/erts/emulator/test/nif_SUITE_data/nif_SUITE.c
@@ -1029,8 +1029,11 @@ static ERL_NIF_TERM make_term_list0(struct make_term_info* mti, int n)
static ERL_NIF_TERM make_term_resource(struct make_term_info* mti, int n)
{
void* resource = enif_alloc_resource(mti->resource_type, 10);
+ ERL_NIF_TERM term;
fill(resource, 10, n);
- return enif_make_resource(mti->dst_env, resource);
+ term = enif_make_resource(mti->dst_env, resource);
+ enif_release_resource(resource);
+ return term;
}
static ERL_NIF_TERM make_term_new_binary(struct make_term_info* mti, int n)
{