--- proto/ospf/dbdes.c	2015-02-20 14:59:33.000000000 +0300
+++ proto/ospf/dbdes.c.new	2015-02-20 14:59:28.000000000 +0300
@@ -112,7 +112,7 @@
 
     if (next)
     {
-      snode *sn;
+      snode *sn = NULL;
       struct ospf_lsa_header *lsa;
 
       if (n->ldd_bsize != ifa->tx_length)
@@ -133,10 +133,8 @@
       j = i = (ospf_pkt_maxsize(ifa) - sizeof(struct ospf_dbdes_packet)) / sizeof(struct ospf_lsa_header);	/* Number of possible lsaheaders to send */
       lsa = (n->ldd_buffer + sizeof(struct ospf_dbdes_packet));
 
-      if (n->myimms.bit.m)
+      if (n->myimms.bit.m && (sn = s_get(&(n->dbsi))))
       {
-	sn = s_get(&(n->dbsi));
-
 	DBG("Number of LSA: %d\n", j);
 	for (; i > 0; i--)
 	{
@@ -170,6 +168,12 @@
 
 	s_put(&(n->dbsi), sn);
       }
+      else if (n->myimms.bit.m)
+      {
+	DBG("Iterator position changed to the last item\n");
+	DBG("M bit unset.\n");
+	n->myimms.bit.m = 0;	/* Unset more bit */
+      }
 
       pkt->imms.byte = n->myimms.byte;
 
