]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Fix empty pools handling
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 24 Aug 2017 12:16:54 +0000 (13:16 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 24 Aug 2017 12:17:16 +0000 (13:17 +0100)
src/libutil/mem_pool.c

index fc0c18e8bf4328d76ed5b467f85f21ebb79279c9..9856e9198fefcaff561e4f59112192ea4592af05 100644 (file)
@@ -656,15 +656,15 @@ rspamd_mempool_delete (rspamd_mempool_t * pool)
        }
 
        if (cur) {
-               pool->entry->elts[pool->entry->cur_elts].leftover +=
+               pool->entry->elts[pool->entry->cur_elts].leftover =
                                pool_chain_free (cur);
-       }
 
-       pool->entry->cur_elts = (pool->entry->cur_elts + 1) %
-                       G_N_ELEMENTS (pool->entry->elts);
+               pool->entry->cur_elts = (pool->entry->cur_elts + 1) %
+                               G_N_ELEMENTS (pool->entry->elts);
 
-       if (pool->entry->cur_elts == 0) {
-               rspamd_mempool_adjust_entry (pool->entry);
+               if (pool->entry->cur_elts == 0) {
+                       rspamd_mempool_adjust_entry (pool->entry);
+               }
        }
 
        /* Call all pool destructors */