From 64ad6e489422f42fdbabb6372122ce2a718d6db1 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Mon, 25 Mar 2019 11:18:27 -0400 Subject: [PATCH] Add missing check_conn when running SQL statements Intermittent errors from the DB can cause the connection to be reset and not re-established for the next statement to be executed, leading to segfaults. fixes #742 Change-Id: I1ed5b75457ab7167a70df5e04a964d37f98e60f7 --- recording-daemon/db.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recording-daemon/db.c b/recording-daemon/db.c index 444b32cdc..33333127b 100644 --- a/recording-daemon/db.c +++ b/recording-daemon/db.c @@ -161,6 +161,8 @@ INLINE void my_d(MYSQL_BIND *b, const double *d) { static void execute_wrap(MYSQL_STMT **stmt, MYSQL_BIND *binds, unsigned long long *auto_id) { int retr = 0; while (1) { + if (check_conn()) + goto err; if (mysql_stmt_bind_param(*stmt, binds)) goto err; if (mysql_stmt_execute(*stmt))