aboutsummaryrefslogtreecommitdiffstats
path: root/lib/erl_interface/src/registry
diff options
context:
space:
mode:
Diffstat (limited to 'lib/erl_interface/src/registry')
-rw-r--r--lib/erl_interface/src/registry/reg_dump.c1
-rw-r--r--lib/erl_interface/src/registry/reg_restore.c5
2 files changed, 4 insertions, 2 deletions
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: