|
3 | 3 | #include <stdio.h> |
4 | 4 |
|
5 | 5 | #include <node_api.h> |
| 6 | + |
6 | 7 | #include <uv.h> |
7 | 8 |
|
8 | 9 | #include "evmc/evmc.h" |
@@ -196,6 +197,7 @@ enum evmc_storage_status set_storage(struct evmc_js_context* context, |
196 | 197 | assert(status == napi_ok); |
197 | 198 |
|
198 | 199 | uv_sem_wait(&callinfo.sem); |
| 200 | + uv_sem_destroy(&callinfo.sem); |
199 | 201 |
|
200 | 202 | status = napi_release_threadsafe_function(context->set_storage_fn, napi_tsfn_release); |
201 | 203 | assert(status == napi_ok); |
@@ -285,6 +287,7 @@ void get_storage_js(napi_env env, napi_value js_callback, struct evmc_js_context |
285 | 287 | assert(status == napi_ok); |
286 | 288 |
|
287 | 289 | uv_sem_wait(&callinfo.sem); |
| 290 | + uv_sem_destroy(&callinfo.sem); |
288 | 291 |
|
289 | 292 | status = napi_release_threadsafe_function(context->get_storage_fn, napi_tsfn_release); |
290 | 293 | assert(status == napi_ok); |
@@ -373,6 +376,7 @@ bool account_exists(struct evmc_js_context* context, |
373 | 376 | assert(status == napi_ok); |
374 | 377 |
|
375 | 378 | uv_sem_wait(&callinfo.sem); |
| 379 | + uv_sem_destroy(&callinfo.sem); |
376 | 380 |
|
377 | 381 | status = napi_release_threadsafe_function(context->account_exists_fn, napi_tsfn_release); |
378 | 382 | assert(status == napi_ok); |
@@ -459,6 +463,7 @@ evmc_bytes32 get_balance(struct evmc_js_context* context, |
459 | 463 | assert(status == napi_ok); |
460 | 464 |
|
461 | 465 | uv_sem_wait(&callinfo.sem); |
| 466 | + uv_sem_destroy(&callinfo.sem); |
462 | 467 |
|
463 | 468 | status = napi_release_threadsafe_function(context->get_balance_fn, napi_tsfn_release); |
464 | 469 | assert(status == napi_ok); |
@@ -550,6 +555,7 @@ size_t get_code_size(struct evmc_js_context* context, |
550 | 555 | assert(status == napi_ok); |
551 | 556 |
|
552 | 557 | uv_sem_wait(&callinfo.sem); |
| 558 | + uv_sem_destroy(&callinfo.sem); |
553 | 559 |
|
554 | 560 | status = napi_release_threadsafe_function(context->get_code_size_fn, napi_tsfn_release); |
555 | 561 | assert(status == napi_ok); |
@@ -637,6 +643,7 @@ evmc_bytes32 get_code_hash(struct evmc_js_context* context, |
637 | 643 | assert(status == napi_ok); |
638 | 644 |
|
639 | 645 | uv_sem_wait(&callinfo.sem); |
| 646 | + uv_sem_destroy(&callinfo.sem); |
640 | 647 |
|
641 | 648 | status = napi_release_threadsafe_function(context->get_code_hash_fn, napi_tsfn_release); |
642 | 649 | assert(status == napi_ok); |
@@ -753,6 +760,7 @@ size_t copy_code(struct evmc_js_context* context, |
753 | 760 | assert(status == napi_ok); |
754 | 761 |
|
755 | 762 | uv_sem_wait(&callinfo.sem); |
| 763 | + uv_sem_destroy(&callinfo.sem); |
756 | 764 |
|
757 | 765 | status = napi_release_threadsafe_function(context->copy_code_fn, napi_tsfn_release); |
758 | 766 | assert(status == napi_ok); |
@@ -836,7 +844,7 @@ void selfdestruct(struct evmc_js_context* context, |
836 | 844 | assert(status == napi_ok); |
837 | 845 |
|
838 | 846 | uv_sem_wait(&callinfo.sem); |
839 | | - |
| 847 | + uv_sem_destroy(&callinfo.sem); |
840 | 848 |
|
841 | 849 | status = napi_release_threadsafe_function(context->selfdestruct_fn, napi_tsfn_release); |
842 | 850 | assert(status == napi_ok); |
@@ -1049,7 +1057,8 @@ struct evmc_result call(struct evmc_js_context* context, |
1049 | 1057 | assert(status == napi_ok); |
1050 | 1058 |
|
1051 | 1059 | uv_sem_wait(&callinfo.sem); |
1052 | | - |
| 1060 | + uv_sem_destroy(&callinfo.sem); |
| 1061 | + |
1053 | 1062 | status = napi_release_threadsafe_function(context->call_fn, napi_tsfn_release); |
1054 | 1063 | assert(status == napi_ok); |
1055 | 1064 |
|
@@ -1208,7 +1217,7 @@ struct evmc_tx_context get_tx_context(struct evmc_js_context* context) { |
1208 | 1217 | assert(status == napi_ok); |
1209 | 1218 |
|
1210 | 1219 | uv_sem_wait(&callinfo.sem); |
1211 | | - |
| 1220 | + uv_sem_destroy(&callinfo.sem); |
1212 | 1221 |
|
1213 | 1222 | status = napi_release_threadsafe_function(context->get_tx_context_fn, napi_tsfn_release); |
1214 | 1223 | assert(status == napi_ok); |
@@ -1295,7 +1304,7 @@ evmc_bytes32 get_block_hash(struct evmc_js_context* context, uint64_t number) { |
1295 | 1304 | assert(status == napi_ok); |
1296 | 1305 |
|
1297 | 1306 | uv_sem_wait(&callinfo.sem); |
1298 | | - |
| 1307 | + uv_sem_destroy(&callinfo.sem); |
1299 | 1308 |
|
1300 | 1309 | status = napi_release_threadsafe_function(context->get_block_hash_fn, napi_tsfn_release); |
1301 | 1310 | assert(status == napi_ok); |
@@ -1406,7 +1415,8 @@ void emit_log(struct evmc_js_context* context, |
1406 | 1415 | assert(status == napi_ok); |
1407 | 1416 |
|
1408 | 1417 | uv_sem_wait(&callinfo.sem); |
1409 | | - |
| 1418 | + uv_sem_destroy(&callinfo.sem); |
| 1419 | + |
1410 | 1420 | status = napi_release_threadsafe_function(context->emit_log_fn, napi_tsfn_release); |
1411 | 1421 | assert(status == napi_ok); |
1412 | 1422 | } |
@@ -1606,6 +1616,8 @@ void completer_js(napi_env env, napi_value js_callback, void* context, struct js |
1606 | 1616 |
|
1607 | 1617 | status = napi_resolve_deferred(env, data->deferred, out); |
1608 | 1618 | assert(status == napi_ok); |
| 1619 | + |
| 1620 | + free(data); |
1609 | 1621 | } |
1610 | 1622 |
|
1611 | 1623 | void execute_done(uv_work_t* work, int status) { |
|
0 commit comments