From 7351578a7ebc1a9c2f3abe6521b7e5a8da6d781c Mon Sep 17 00:00:00 2001 From: Gowtham sree charan reddy Date: Mon, 25 May 2026 00:34:48 +0530 Subject: [PATCH] fix: Finalize prepared statement on validation errors. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- server.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server.js b/server.js index 47e1429..0636a1d 100644 --- a/server.js +++ b/server.js @@ -355,10 +355,10 @@ app.post('/api/tasks', (req, res) => { pending--; if (pending === 0) { if (inserted === 0) { - return res.status(400).json({ + return stmt.finalize(() => res.status(400).json({ success: false, inserted, duplicates, errors, message: errors.length === tasks.length ? errors[0].error : "Some tasks are invalid" - }); + })); } stmt.finalize(() => res.status(400).json({ success: false, inserted, duplicates, errors,