diff --git a/src/kde/kioslave/kio_recoll/kio_recoll.cpp b/src/kde/kioslave/kio_recoll/kio_recoll.cpp
index 51284c23..afc74ac2 100644
--- a/kde/kioslave/kio_recoll/kio_recoll.cpp
+++ b/kde/kioslave/kio_recoll/kio_recoll.cpp
@@ -48,8 +48,7 @@ using namespace std;
 RclConfig *RecollProtocol::o_rclconfig;
 
 RecollProtocol::RecollProtocol(const QByteArray& pool, const QByteArray& app)
-    : SlaveBase("recoll", pool, app), m_initok(false), m_rcldb(0),
-      m_alwaysdir(false)
+    : SlaveBase("recoll", pool, app), m_initok(false), m_alwaysdir(false)
 {
     qDebug() << "RecollProtocol::RecollProtocol()";
     if (o_rclconfig == 0) {
@@ -68,7 +67,7 @@ RecollProtocol::RecollProtocol(const QByteArray& pool, const QByteArray& app)
     }
     rwSettings(false);
 
-    m_rcldb = new Rcl::Db(o_rclconfig);
+    m_rcldb = std::shared_ptr<Rcl::Db>(new Rcl::Db(o_rclconfig));
     if (!m_rcldb) {
         m_reason = "Could not build database object. (out of memory ?)";
         return;
@@ -100,7 +99,6 @@ RecollProtocol::RecollProtocol(const QByteArray& pool, const QByteArray& app)
 RecollProtocol::~RecollProtocol()
 {
     qDebug() << "RecollProtocol::~RecollProtocol()";
-    delete m_rcldb;
 }
 
 bool RecollProtocol::maybeOpenDb(string& reason)
@@ -337,7 +335,7 @@ bool RecollProtocol::doSearch(const QueryDesc& qd)
     }
 
     std::shared_ptr<Rcl::SearchData> sdata(sd);
-    std::shared_ptr<Rcl::Query>query(new Rcl::Query(m_rcldb));
+    std::shared_ptr<Rcl::Query>query(new Rcl::Query(m_rcldb.get()));
     query->setCollapseDuplicates(prefs.collapseDuplicates);
     if (!query->setQuery(sdata)) {
         m_reason = "Query execute failed. Invalid query or syntax error?";
@@ -346,7 +344,8 @@ bool RecollProtocol::doSearch(const QueryDesc& qd)
     }
 
     DocSequenceDb *src =
-        new DocSequenceDb(std::shared_ptr<Rcl::Query>(query), "Query results", sdata);
+        new DocSequenceDb(m_rcldb, std::shared_ptr<Rcl::Query>(query),
+                          "Query results", sdata);
     if (src == 0) {
         error(KIO::ERR_SLAVE_DEFINED, u8s2qs("Can't build result sequence"));
         return false;
diff --git a/src/kde/kioslave/kio_recoll/kio_recoll.h b/src/kde/kioslave/kio_recoll/kio_recoll.h
index 628bbe71..441def11 100644
--- a/kde/kioslave/kio_recoll/kio_recoll.h
+++ b/kde/kioslave/kio_recoll/kio_recoll.h
@@ -177,7 +177,7 @@ private:
     bool isRecollResult(const QUrl& url, int *num, QString* q);
 
     bool        m_initok;
-    Rcl::Db    *m_rcldb;
+    std::shared_ptr<Rcl::Db> m_rcldb;
     std::string      m_reason;
     bool        m_alwaysdir;
     // english by default else env[RECOLL_KIO_STEMLANG]
