n-api: fix object test

Passing a pointer to a static integer is sufficient for the test.

PR-URL: https://github.com/nodejs/node/pull/19039
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Hitesh Kanwathirtha <hiteshk@microsoft.com>
This commit is contained in:
Gabriel Schulhof authored and Anna Henningsen committed 2018-03-05 10:07:17 +00:00
1 parent 08b83ee27a
commit 1b32fc3276
1 file changed
+1 -4
+1 -4
View File
@@ -1,7 +1,6 @@
#include <node_api.h>
#include "../common.h"
#include <string.h>
#include <stdlib.h>
static int test_value = 3;
@@ -199,9 +198,7 @@ napi_value Wrap(napi_env env, napi_callback_info info) {
napi_value arg;
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, &arg, NULL, NULL));
int32_t* data = malloc(sizeof(int32_t));
*data = test_value;
NAPI_CALL(env, napi_wrap(env, arg, data, NULL, NULL, NULL));
NAPI_CALL(env, napi_wrap(env, arg, &test_value, NULL, NULL, NULL));
return NULL;
}