Skip to content
This repository was archived by the owner on Jul 1, 2024. It is now read-only.

Commit b896ad6

Browse files
Actually fix memory leak
1 parent 73acc0e commit b896ad6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

cppsrc/detector.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,10 @@ Value Detector::detectImageBuffer(const CallbackInfo &info) {
116116
float h = info[2].ToNumber();
117117
float c = info[3].ToNumber();
118118

119-
image i = make_image(w, h, c);
119+
image i;
120+
i.h = h;
121+
i.w = w;
122+
i.c = c;
120123
i.data = static_cast<float *>(buffer.ArrayBuffer().Data());
121124

122125
float thresh = info[4].ToNumber();
@@ -127,8 +130,6 @@ Value Detector::detectImageBuffer(const CallbackInfo &info) {
127130

128131
Array det = this->detectImageInternal(env, i, thresh, heir, nms, rel);
129132

130-
free_image(i);
131-
132133
return det;
133134
}
134135

0 commit comments

Comments
 (0)