Skip to content

Commit 6f9c1a0

Browse files
committed
Fixed prepared statement leak
1 parent fcb864d commit 6f9c1a0

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

src/connection.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ GameDataDBAsyncResult* Connection::pushAsyncQuery(game_state& gs, mariadb::conne
136136
throwQueryError(gs, con, 1337, static_cast<r_string>(x.what()), queryString);
137137
return false;
138138
}
139-
});
139+
}, true);
140140
return gd_res;
141141
}
142142

src/threading.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "threading.h"
22
#include "ittnotify.h"
3+
#include "../ittnotify/ittnotify.h"
34
using namespace std::chrono_literals;
45

56
#include <iomanip> // put_time
@@ -80,9 +81,10 @@ void Worker::run() {
8081
__itt_task_begin(domain, __itt_null, __itt_null, worker_processTaskTask);
8182
uint64_t tasksLeft = tasks.size();
8283
__itt_counter_set_value(counter, &tasksLeft);
83-
if (!tasks.empty()) {
84+
if (tasksLeft) {
8485
std::shared_ptr<Task> task = tasks.front();
8586
tasks.pop();
87+
tasksLeft--;
8688
lastJob = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
8789
__itt_sync_releasing(&taskLock);
8890
l.unlock();
@@ -91,7 +93,7 @@ void Worker::run() {
9193
task->prom.set_value(task->job(workerConnection));
9294
__itt_task_end(domain);
9395
if (task->isInWorkList || rememberUpdateWorklist) {
94-
if (tasksLeft % 64 == 0) {
96+
if (tasksLeft % 64 == 0) { //Don't trust the compiler telling you nonsense
9597
Threading::get().updateAsyncWorkLists();
9698
rememberUpdateWorklist = false;
9799
} else

0 commit comments

Comments
 (0)