From d2463745a705a941db26429b89fae1607bca70c1 Mon Sep 17 00:00:00 2001 From: Gabriel Schulhof Date: Tue, 27 Feb 2018 13:02:24 -0500 Subject: [PATCH] n-api: fix object test Passing a pointer to a static integer is sufficient for the test. Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/19039 Reviewed-By: Colin Ihrig Reviewed-By: Michael Dawson Reviewed-By: Hitesh Kanwathirtha --- test/addons-napi/test_object/test_object.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/test/addons-napi/test_object/test_object.c b/test/addons-napi/test_object/test_object.c index 75e0ee4c30f85c..a84da27365ff2e 100644 --- a/test/addons-napi/test_object/test_object.c +++ b/test/addons-napi/test_object/test_object.c @@ -1,7 +1,6 @@ #include #include "../common.h" #include -#include 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; }