Skip to content

Commit

Permalink
n-api: fix object test
Browse files Browse the repository at this point in the history
Passing a pointer to a static integer is sufficient for the test.

Backport-PR-URL: #19265
PR-URL: #19039
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Hitesh Kanwathirtha <hiteshk@microsoft.com>
  • Loading branch information
Gabriel Schulhof authored and MylesBorins committed May 1, 2018
1 parent 6129ff4 commit cb3f90a
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions test/addons-napi/test_object/test_object.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include <node_api.h>
#include "../common.h"
#include <string.h>
#include <stdlib.h>

static int test_value = 3;

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit cb3f90a

Please sign in to comment.