diff --git a/epicardium/ble/bondings.c b/epicardium/ble/bondings.c
index 42a06f133841384477c273a7c58b17c2db98655e..71609459da7addc0cc29d58dfb5ca4ef3aec5081 100644
--- a/epicardium/ble/bondings.c
+++ b/epicardium/ble/bondings.c
@@ -114,9 +114,6 @@ typedef struct
 /*! Database */
 static appDbRec_t records[APP_DB_NUM_RECS];
 
-/*! When all records are allocated use this index to determine which to overwrite */
-static appDbRec_t *pAppDbNewRec = records;
-
 /* clang-format on */
 /* Translate a pointer to a record into the filename to be used for it. */
 static int record_to_filename(appDbRec_t *record, char *buf, size_t buf_size)
@@ -317,7 +314,7 @@ void AppDbInit(void)
  *  \param  addrType  Address type.
  *  \param  pAddr     Peer device address.
  *
- *  \return Database record handle.
+ *  \return Database record handle. APP_DB_HDL_NONE if none is available.
  */
 /*************************************************************************************************/
 appDbHdl_t AppDbNewRecord(uint8_t addrType, uint8_t *pAddr)
@@ -337,15 +334,7 @@ appDbHdl_t AppDbNewRecord(uint8_t addrType, uint8_t *pAddr)
   /* if all records were allocated */
   if (i == 0)
   {
-    /* overwrite a record */
-    pRec = pAppDbNewRec;
-
-    /* get next record to overwrite */
-    pAppDbNewRec++;
-    if (pAppDbNewRec == &records[APP_DB_NUM_RECS])
-    {
-      pAppDbNewRec = records;
-    }
+    return APP_DB_HDL_NONE;
   }
 
   /* initialize record */
diff --git a/lib/sdk/Libraries/BTLE/stack/ble-profiles/sources/apps/app/app_slave.c b/lib/sdk/Libraries/BTLE/stack/ble-profiles/sources/apps/app/app_slave.c
index bc298c74595898cbbbd05fa3dc9333e41c66505b..741161758dfdce9f561998b55b7ed526e6ac756b 100644
--- a/lib/sdk/Libraries/BTLE/stack/ble-profiles/sources/apps/app/app_slave.c
+++ b/lib/sdk/Libraries/BTLE/stack/ble-profiles/sources/apps/app/app_slave.c
@@ -706,6 +706,13 @@ static void appSecPairInd(dmEvt_t *pMsg, appConnCb_t *pCb)
     {
       /* create a device record if none exists */
       pCb->dbHdl = AppDbNewRecord(DmConnPeerAddrType(pCb->connId), DmConnPeerAddr(pCb->connId));
+
+      /* If there is no free record available, fail the pairing attempt */
+      if (pCb->dbHdl == APP_DB_HDL_NONE)
+      {
+        DmSecCancelReq(pCb->connId, SMP_ERR_PAIRING_NOT_SUP);
+        return;
+      }
     }
 
     /* initialize stored keys */