Skip to content

Commit 8bf12c5

Browse files
committed
Possible fix of some mem leaks
1 parent 5c8e36f commit 8bf12c5

1 file changed

Lines changed: 8 additions & 12 deletions

File tree

src/query.c

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -134,22 +134,18 @@ void execute_step(step_t *step)
134134
if (left_step) {
135135
if (atomic_load(&left_step->quit)) {
136136
atomic_store(&step->quit, true);
137-
free(output);
138137
//step->quit = true;
139-
return;
140138
}
141-
spsc_dequeue(left_queue, &left_input);
142-
assert(left_input);
139+
if(spsc_dequeue(left_queue, &left_input))
140+
assert(left_input);
143141
}
144142
if (right_step) {
145143
if (atomic_load(&right_step->quit)) {
146144
atomic_store(&step->quit, true);
147-
free(output);
148145
//step->quit = true;
149-
return;
150146
}
151-
spsc_dequeue(right_queue, &right_input);
152-
assert(right_input);
147+
if(spsc_dequeue(right_queue, &right_input))
148+
assert(right_input);
153149
}
154150
if (atomic_load(&step->quit)) {
155151
free(output);
@@ -190,8 +186,8 @@ void execute_step(step_t *step)
190186

191187
skip:
192188
if (left_step) {
193-
assert(left_input);
194-
if (op->left->type != WINDOW) {
189+
if (op->left->type != WINDOW && left_input) {
190+
assert(left_input);
195191
free(left_input->data); left_input->data = NULL;
196192
free(left_input); left_input = NULL;
197193
}
@@ -200,8 +196,8 @@ void execute_step(step_t *step)
200196
}
201197
}
202198
if (right_step) {
203-
assert(right_input);
204-
if (op->right->type != WINDOW) {
199+
if (op->right->type != WINDOW && right_input) {
200+
assert(right_input);
205201
free(right_input->data); right_input->data = NULL;
206202
free(right_input); right_input = NULL;
207203
}

0 commit comments

Comments
 (0)