Skip to content

Commit 10df5e1

Browse files
committed
Solve issues with pointers in node loader.
1 parent b6054ce commit 10df5e1

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

source/loaders/node_loader/source/node_loader_impl.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,14 +1442,13 @@ value node_loader_impl_napi_to_value(loader_impl_node node_impl, napi_env env, n
14421442
}
14431443
else if (valuetype == napi_external)
14441444
{
1445-
/* Returns the previously allocated copy */
14461445
void *c = nullptr;
14471446

14481447
status = napi_get_value_external(env, v, &c);
14491448

14501449
node_loader_impl_exception(env, status);
14511450

1452-
return c;
1451+
return value_create_ptr(c);
14531452
}
14541453

14551454
return ret;
@@ -1635,10 +1634,7 @@ napi_value node_loader_impl_value_to_napi(loader_impl_node node_impl, napi_env e
16351634
}
16361635
else if (id == TYPE_PTR)
16371636
{
1638-
/* Copy value and set the ownership, the old value will be deleted after the call */
1639-
void *c = value_copy(arg_value);
1640-
1641-
value_move(arg_value, c);
1637+
void *c = value_to_ptr(arg_value);
16421638

16431639
status = napi_create_external(env, c, nullptr, nullptr, &v);
16441640

0 commit comments

Comments
 (0)