diff options
author | Henrik Nord <[email protected]> | 2011-09-20 11:19:21 +0200 |
---|---|---|
committer | Henrik Nord <[email protected]> | 2011-09-20 11:19:21 +0200 |
commit | ec36499d7e329b4dc69a1a3be3422eac7907c260 (patch) | |
tree | 3fae5bd47f85aa8a3ac40519b2328c4451a00c18 /lib/erl_interface | |
parent | 532c72b3ffeb9219bdb7e6a7f5d21fe26f0f0629 (diff) | |
parent | 53cf0b70c705e0bf6c09f83f2ce2709d79593ce6 (diff) | |
download | otp-ec36499d7e329b4dc69a1a3be3422eac7907c260.tar.gz otp-ec36499d7e329b4dc69a1a3be3422eac7907c260.tar.bz2 otp-ec36499d7e329b4dc69a1a3be3422eac7907c260.zip |
Merge branch 'dev' into major
Conflicts:
erts/aclocal.m4
erts/include/internal/ethread_header_config.h.in
Diffstat (limited to 'lib/erl_interface')
-rw-r--r-- | lib/erl_interface/doc/src/ei.xml | 6 | ||||
-rw-r--r-- | lib/erl_interface/src/legacy/erl_fix_alloc.c | 4 | ||||
-rw-r--r-- | lib/erl_interface/src/misc/ei_decode_term.c | 10 | ||||
-rw-r--r-- | lib/erl_interface/src/registry/reg_dump.c | 1 | ||||
-rw-r--r-- | lib/erl_interface/src/registry/reg_restore.c | 5 |
5 files changed, 16 insertions, 10 deletions
diff --git a/lib/erl_interface/doc/src/ei.xml b/lib/erl_interface/doc/src/ei.xml index de4e4b4301..76e02a6858 100644 --- a/lib/erl_interface/doc/src/ei.xml +++ b/lib/erl_interface/doc/src/ei.xml @@ -581,9 +581,9 @@ ei_x_encode_empty_list(&x); <c><![CDATA[term]]></c> union, it is decoded, and the appropriate field in <c><![CDATA[term->value]]></c> is set, and <c><![CDATA[*index]]></c> is incremented by the term size.</p> - <p>The function returns 0 on successful decoding, -1 on error, - and 1 if the term seems alright, but does not fit in the - <c><![CDATA[term]]></c> structure. If it returns 0, the <c><![CDATA[index]]></c> + <p>The function returns 1 on successful decoding, -1 on error, + and 0 if the term seems alright, but does not fit in the + <c><![CDATA[term]]></c> structure. If it returns 1, the <c><![CDATA[index]]></c> will be incremented, and the <c><![CDATA[term]]></c> contains the decoded term.</p> <p>The <c><![CDATA[term]]></c> structure will contain the arity for a tuple diff --git a/lib/erl_interface/src/legacy/erl_fix_alloc.c b/lib/erl_interface/src/legacy/erl_fix_alloc.c index 20f3024e41..ca09fc3b8b 100644 --- a/lib/erl_interface/src/legacy/erl_fix_alloc.c +++ b/lib/erl_interface/src/legacy/erl_fix_alloc.c @@ -109,6 +109,10 @@ void *erl_eterm_alloc (void) erl_eterm_state->freed--; } else if ((b = malloc(sizeof(*b))) == NULL) { erl_errno = ENOMEM; +#ifdef _REENTRANT + ei_mutex_unlock(erl_eterm_state->lock); +#endif /* _REENTRANT */ + return NULL; } erl_eterm_state->allocated++; b->free = 0; diff --git a/lib/erl_interface/src/misc/ei_decode_term.c b/lib/erl_interface/src/misc/ei_decode_term.c index bfb4571337..0b82ef0e35 100644 --- a/lib/erl_interface/src/misc/ei_decode_term.c +++ b/lib/erl_interface/src/misc/ei_decode_term.c @@ -25,8 +25,8 @@ #include "ei_decode_term.h" #include "putget.h" -/* Returns 0 on successful encoding, -1 on error, and 1 if the term seems - alright, but does not fit in the term structure. If it returns 0, the +/* Returns 1 on successful encoding, -1 on error, and 0 if the term seems + alright, but does not fit in the term structure. If it returns 1, the index will be incremented, and the term contains the decoded term. */ int ei_decode_ei_term(const char* buf, int* index, ei_term* term) @@ -111,10 +111,10 @@ int ei_decode_ei_term(const char* buf, int* index, ei_term* term) break; case ERL_SMALL_TUPLE_EXT: term->arity = get8(s); - break; /*return 0;*/ + break; case ERL_LARGE_TUPLE_EXT: term->arity = get32be(s); - break; /*return 0;*/ + break; case ERL_NIL_EXT: term->arity = 0; break; @@ -123,7 +123,7 @@ int ei_decode_ei_term(const char* buf, int* index, ei_term* term) return 0; case ERL_LIST_EXT: term->arity = get32be(s); - break; /*return 0;*/ + break; case ERL_BINARY_EXT: term->size = get32be(s); return 0; diff --git a/lib/erl_interface/src/registry/reg_dump.c b/lib/erl_interface/src/registry/reg_dump.c index 1e640fb506..d2854c10b5 100644 --- a/lib/erl_interface/src/registry/reg_dump.c +++ b/lib/erl_interface/src/registry/reg_dump.c @@ -215,6 +215,7 @@ static int mn_send_write(int fd, erlang_pid *mnesia, const char *key, ei_reg_obj else ei_encode_long(msgbuf,&index,(long)(obj->val.p)); /* just the pointer */ break; default: + if (dbuf) free(dbuf); return -1; } diff --git a/lib/erl_interface/src/registry/reg_restore.c b/lib/erl_interface/src/registry/reg_restore.c index 765c3f4314..7bc1c758af 100644 --- a/lib/erl_interface/src/registry/reg_restore.c +++ b/lib/erl_interface/src/registry/reg_restore.c @@ -303,6 +303,9 @@ int ei_reg_restore(int fd, ei_reg *reg, const char *mntab) if (mn_decode_insert(reg,msgbuf,&index,keybuf)) goto restore_failure; } + if (keybuf) free(keybuf); + if (dbuf) free(dbuf); + /* wait for unlink */ if (mn_unlink(fd)) return -1; @@ -310,8 +313,6 @@ int ei_reg_restore(int fd, ei_reg *reg, const char *mntab) ei_hash_foreach(reg->tab,clean_obj); /* success */ - if (keybuf) free(keybuf); - if (dbuf) free(dbuf); return 0; restore_failure: |