Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Schulhof <gabriel.schulhof@intel.com>2018-02-27 21:02:24 +0300
committerGabriel Schulhof <gabriel.schulhof@intel.com>2018-03-02 17:29:24 +0300
commitc698017a2fc25d51b0ace432c539d24b7d7af709 (patch)
tree917cc5b4c8cc40b15bfe2bdd4c2d5de4e7bfb3b2 /test/addons-napi/test_object
parentf7e5b385a7d4084714c1360079d46d0725e7879a (diff)
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>
Diffstat (limited to 'test/addons-napi/test_object')
-rw-r--r--test/addons-napi/test_object/test_object.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/test/addons-napi/test_object/test_object.c b/test/addons-napi/test_object/test_object.c
index 49a90dd3f99..ccf1573114a 100644
--- a/test/addons-napi/test_object/test_object.c
+++ b/test/addons-napi/test_object/test_object.c
@@ -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;
}