From 0405196b1a63aa7e25a4ad6e78e39bbefe2f06b3 Mon Sep 17 00:00:00 2001
From: feiniks <36756310+feiniks@users.noreply.github.com>
Date: Wed, 9 Apr 2025 17:44:26 +0800
Subject: [PATCH] Fix crash when mysql stop (#755)

Co-authored-by: Heran Yang <heran.yang@seafile.com>
---
 common/rpc-service.c | 1 +
 common/seaf-db.c     | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/common/rpc-service.c b/common/rpc-service.c
index 0cbca4c..6b34a9d 100644
--- a/common/rpc-service.c
+++ b/common/rpc-service.c
@@ -3873,6 +3873,7 @@ seafile_check_repo_blocks_missing (const char *repo_id,
     free (json_data);
     json_decref (ret_json);
     json_decref (array);
+    seaf_repo_unref (repo);
     return ret;
 }
 
diff --git a/common/seaf-db.c b/common/seaf-db.c
index 788c7c8..6176b7c 100644
--- a/common/seaf-db.c
+++ b/common/seaf-db.c
@@ -150,7 +150,7 @@ out:
         for (index = size - 1; index >= 0; index--) {
             d_conn = g_ptr_array_index (pool->connections, index);
             if (d_conn->delete_pending) {
-                g_ptr_array_remove (conn->pool->connections, d_conn);
+                g_ptr_array_remove (pool->connections, d_conn);
                 mysql_db_release_connection (d_conn);
             }
         }