aboutsummaryrefslogtreecommitdiffstats
path: root/lib/erl_interface/src/legacy/global_whereis.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/erl_interface/src/legacy/global_whereis.c')
-rw-r--r--lib/erl_interface/src/legacy/global_whereis.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/erl_interface/src/legacy/global_whereis.c b/lib/erl_interface/src/legacy/global_whereis.c
index 2afb193504..e6c556d907 100644
--- a/lib/erl_interface/src/legacy/global_whereis.c
+++ b/lib/erl_interface/src/legacy/global_whereis.c
@@ -85,7 +85,16 @@ ETERM *erl_global_whereis(int fd, const char *name, char *node)
opid = erl_decode((unsigned char*)buf);
/* extract the nodename for the caller */
- if (node) strcpy(node,epid.node);
+ if (node) {
+ char* node_str = ERL_PID_NODE(opid);
+ if (node_str) {
+ strcpy(node, node_str);
+ }
+ else {
+ erl_free_term(opid);
+ return NULL;
+ }
+ }
return opid;
}