Commit Diff


commit - b1fad72fdca8c2a237161cac88778e31a58bccb1
commit + c94b2859b3b5268adec2353832d0491a11382f83
blob - 688a6e57f5be05fe9d93c7fef20f787f9e540f6a
blob + 937f773ec4d344ede28101ce0f83ff4e4b148d28
--- lib/delta_cache.c
+++ lib/delta_cache.c
@@ -158,8 +158,10 @@ delta_cache_resize(struct got_delta_cache *cache, unsi
 				new_delta = &head->entries[head->nchain];
 				memcpy(new_delta, delta, sizeof(*new_delta));
 				head->nchain++;
-			} else
+			} else {
 				free(delta->data);
+				cache->totelem--;
+			}
 		}
 	}
 
@@ -217,6 +219,8 @@ got_delta_cache_add(struct got_delta_cache *cache,
 		free(delta->data);
 		memset(delta, 0, sizeof(*delta));
 		head->nchain--;
+		cache->totelem--;
+		cache->cache_evict++;
 	}
 
 	delta = &head->entries[head->nchain];