Skip to content

Commit 0cee0df

Browse files
committed
src: fix issue with Windows using separate heap for node addons
Passing the callback ensures we do the free() inside the addon, where the heap is the same.
1 parent 255fe30 commit 0cee0df

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,8 @@ jobs:
9090
run: npm install
9191
- name: Run tests
9292
run: npm test
93+
- name: debug
94+
if: ${{ failure() }}
95+
uses: mxschmitt/action-tmate@v3
96+
with:
97+
limit-access-to-actor: true

src/binding.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ typedef struct {
5151
void* val;
5252
} RowValue;
5353

54+
void free_blob(char* data, void* hint) {
55+
free(data);
56+
}
57+
5458
class BindValueBlob {
5559
public:
5660
BindValueBlob(Local<Value>& buf_) {
@@ -806,6 +810,11 @@ void QueryAfter(uv_work_t* req, int status) {
806810
val = Nan::NewBuffer(
807811
static_cast<char*>(query_req->results[i][j][k].val),
808812
query_req->results[i][j][k].len
813+
#ifdef _MSC_VER
814+
,
815+
free_blob,
816+
nullptr
817+
#endif
809818
).ToLocalChecked();
810819
break;
811820
}

0 commit comments

Comments
 (0)