diff options
author | Sverker Eriksson <[email protected]> | 2012-03-15 12:13:28 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2012-03-15 12:30:34 +0100 |
commit | 2fbe8cc9b3f6f443ccccfaa485b05966aacc65d9 (patch) | |
tree | 2cc1d689b84b2025b66c9223c615ab014a3753e2 /lib/kernel/test/zlib_SUITE.erl | |
parent | 7484721f847e95380e66456b4a55e08481b570d8 (diff) | |
download | otp-2fbe8cc9b3f6f443ccccfaa485b05966aacc65d9.tar.gz otp-2fbe8cc9b3f6f443ccccfaa485b05966aacc65d9.tar.bz2 otp-2fbe8cc9b3f6f443ccccfaa485b05966aacc65d9.zip |
Fix port leaks in zlib
zip,unzip,gzip,gunzip,compress and uncompress did not close the port
when given invalid data argument. Fixed by putting close in "try-after".
A closed port could in same cases get stuck in limbo due to data in
io-queue. Fixed by adding a flush callback.
Diffstat (limited to 'lib/kernel/test/zlib_SUITE.erl')
-rw-r--r-- | lib/kernel/test/zlib_SUITE.erl | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/kernel/test/zlib_SUITE.erl b/lib/kernel/test/zlib_SUITE.erl index 74bafe8935..e0fd0f5d19 100644 --- a/lib/kernel/test/zlib_SUITE.erl +++ b/lib/kernel/test/zlib_SUITE.erl @@ -73,6 +73,7 @@ suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> [{group, api}, {group, examples}, {group, func}, smp, + otp_9981, otp_7359]. groups() -> @@ -964,6 +965,24 @@ otp_7359_def_inf(Data,{DefSize,InfSize}) -> ?line ok = zlib:close(ZInf), ok. +otp_9981(Config) when is_list(Config) -> + Ports = lists:sort(erlang:ports()), + Invalid = <<"My invalid data">>, + catch zlib:compress(invalid), + Ports = lists:sort(erlang:ports()), + catch zlib:uncompress(Invalid), + Ports = lists:sort(erlang:ports()), + catch zlib:zip(invalid), + Ports = lists:sort(erlang:ports()), + catch zlib:unzip(Invalid), + Ports = lists:sort(erlang:ports()), + catch zlib:gzip(invalid), + Ports = lists:sort(erlang:ports()), + catch zlib:gunzip(Invalid), + Ports = lists:sort(erlang:ports()), + ok. + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Helps with testing directly %%%%%%%%%%%%% |