protect access to the counter by mutex, else we might get race conditions.
authorWilfried Goesgens <dothebart@citadel.org>
Sat, 20 Aug 2011 17:37:45 +0000 (17:37 +0000)
committerWilfried Goesgens <dothebart@citadel.org>
Sat, 20 Aug 2011 17:37:45 +0000 (17:37 +0000)
citadel/modules/smtp/serv_smtpqueue.c

index 6b46164c611e399605d040268bc0f6116c26d97a..6ce5600728ecde9616b4309d292c39fd522ae632 100644 (file)
@@ -117,8 +117,10 @@ int DecreaseQReference(OneQueItem *MyQItem)
 {
        int IDestructQueItem;
 
+       citthread_mutex_lock(&ActiveQItemsLock);
        MyQItem->ActiveDeliveries--;
        IDestructQueItem = MyQItem->ActiveDeliveries == 0;
+       citthread_mutex_unlock(&ActiveQItemsLock);
        return IDestructQueItem;
 }