aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Polvorin <pablo.polvorin@process-one.net>2012-11-09 16:57:23 -0300
committerPablo Polvorin <pablo.polvorin@process-one.net>2012-11-09 16:57:23 -0300
commitac8c536b50a9e80a18c233f1dd9948578c2aa071 (patch)
tree16e3ad64dcc7ab3974de9cfa98d1127302c8ed81
parentDocument MUC domain_balancing broadcast (EJABS-1866) (diff)
Improvement
Force the binary to be a heap binary, rather than keeping it as a refcount or sub-binary
-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.