Skip to content

Commit 1b32fc3

Browse files
Gabriel Schulhofaddaleax
authored andcommitted
n-api: fix object test
Passing a pointer to a static integer is sufficient for the test. PR-URL: #19039 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Hitesh Kanwathirtha <[email protected]>
1 parent 08b83ee commit 1b32fc3

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

‎test/addons-napi/test_object/test_object.c‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include<node_api.h>
22
#include"../common.h"
33
#include<string.h>
4-
#include<stdlib.h>
54

65
staticinttest_value=3;
76

@@ -199,9 +198,7 @@ napi_value Wrap(napi_env env, napi_callback_info info){
199198
napi_valuearg;
200199
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, &arg, NULL, NULL));
201200

202-
int32_t*data=malloc(sizeof(int32_t));
203-
*data=test_value;
204-
NAPI_CALL(env, napi_wrap(env, arg, data, NULL, NULL, NULL));
201+
NAPI_CALL(env, napi_wrap(env, arg, &test_value, NULL, NULL, NULL));
205202
returnNULL;
206203
}
207204

0 commit comments

Comments
(0)