aboutsummaryrefslogtreecommitdiffstats
path: root/lib/erl_interface/src/legacy/erl_malloc.c
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2013-01-11 17:27:29 +0100
committerSverker Eriksson <[email protected]>2013-01-18 15:04:03 +0100
commitb553664f54034e8c04ae6f9cc44f16b7f516518b (patch)
tree1522c655fea9aa52476e997aa26f1512d3ecada4 /lib/erl_interface/src/legacy/erl_malloc.c
parent97abb095cd2182d5c3fafd525da4943ef74dc8e5 (diff)
downloadotp-b553664f54034e8c04ae6f9cc44f16b7f516518b.tar.gz
otp-b553664f54034e8c04ae6f9cc44f16b7f516518b.tar.bz2
otp-b553664f54034e8c04ae6f9cc44f16b7f516518b.zip
erl_interface: utf8 atoms continued
Diffstat (limited to 'lib/erl_interface/src/legacy/erl_malloc.c')
-rw-r--r--lib/erl_interface/src/legacy/erl_malloc.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/lib/erl_interface/src/legacy/erl_malloc.c b/lib/erl_interface/src/legacy/erl_malloc.c
index f51a6c69b3..d09239e02d 100644
--- a/lib/erl_interface/src/legacy/erl_malloc.c
+++ b/lib/erl_interface/src/legacy/erl_malloc.c
@@ -112,6 +112,18 @@ do { \
(ptr) = NULL; \
} while (0)
+static void erl_atom_free(Erl_Atom_data* p)
+{
+ erl_free(p->latin1);
+ if (p->utf8 != p->latin1) {
+ erl_free(p->utf8);
+ }
+ p->latin1 = NULL;
+ p->utf8 = NULL;
+ p->lenL = 0;
+ p->lenU = 0;
+}
+
static void _erl_free_term (ETERM *ep, int external, int compound)
{
restart:
@@ -122,7 +134,7 @@ restart:
switch(ERL_TYPE(ep))
{
case ERL_ATOM:
- FREE_AND_CLEAR(ERL_ATOM_PTR(ep));
+ erl_atom_free(&ep->uval.aval.d);
break;
case ERL_VARIABLE:
FREE_AND_CLEAR(ERL_VAR_NAME(ep));
@@ -161,13 +173,13 @@ restart:
FREE_AND_CLEAR(ERL_BIN_PTR(ep));
break;
case ERL_PID:
- FREE_AND_CLEAR(ERL_PID_NODE(ep));
+ erl_atom_free(&ep->uval.pidval.node);
break;
case ERL_PORT:
- FREE_AND_CLEAR(ERL_PORT_NODE(ep));
+ erl_atom_free(&ep->uval.portval.node);
break;
case ERL_REF:
- FREE_AND_CLEAR(ERL_REF_NODE(ep));
+ erl_atom_free(&ep->uval.refval.node);
break;
case ERL_EMPTY_LIST:
case ERL_INTEGER: