before removing an entry from an hash, revalidate whether we actualy found it
[citadel.git] / citadel / modules / pop3client / serv_pop3client.c
index 8bd39899c5037f5ff31a5791e776fb68f755ddca..9e9ac87d0baa91dded211f6f9f0011d461aa5fd8 100644 (file)
@@ -165,8 +165,8 @@ eNextState FinalizePOP3AggrRun(AsyncIO *IO)
        It = GetNewHashPos(POP3FetchUrls, 0);
        pthread_mutex_lock(&POP3QueueMutex);
        {
-               GetHashPosFromKey(POP3FetchUrls, SKEY(cptr->Url), It);
-               DeleteEntryFromHash(POP3FetchUrls, It);
+               if (GetHashPosFromKey(POP3FetchUrls, SKEY(cptr->Url), It))
+                       DeleteEntryFromHash(POP3FetchUrls, It);
        }
        pthread_mutex_unlock(&POP3QueueMutex);
        DeleteHashPos(&It);