aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/stringprep/stringprep.erl5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/stringprep/stringprep.erl b/src/stringprep/stringprep.erl
index 9458af58e..8bbc5d213 100644
--- a/src/stringprep/stringprep.erl
+++ b/src/stringprep/stringprep.erl
@@ -101,5 +101,8 @@ resourceprep(String) ->
control(Command, String) ->
case port_control(?STRINGPREP_PORT, Command, String) of
<<0, _/binary>> -> error;
- <<1, Res/binary>> -> Res
+ <<1, Res/binary>> -> binary:copy(Res)
+ %% Result is usually a very small binary, that fit into a heap binary.
+ %% binary:copy() ensure that's the case, instead of keeping a subbinary or
+ %% refcount binary around
end.