[PATCH 06/13] Free the LRU object and set free_offset when dropping empty segments in smp_close_seg()
Martin Blix Grydeland
martin at varnish-software.com
Mon Oct 1 12:26:13 CEST 2012
Fixes: #1146
---
bin/varnishd/storage/storage_persistent_silo.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/bin/varnishd/storage/storage_persistent_silo.c b/bin/varnishd/storage/storage_persistent_silo.c
index 6ed80d2..d433cde 100644
--- a/bin/varnishd/storage/storage_persistent_silo.c
+++ b/bin/varnishd/storage/storage_persistent_silo.c
@@ -253,9 +253,11 @@ smp_close_seg(struct smp_sc *sc, struct smp_seg *sg)
sc->cur_seg = NULL;
if (sg->nalloc == 0) {
- /* XXX: if segment is empty, delete instead */
+ /* If segment is empty, delete instead */
+ sc->free_offset = sg->p.offset;
VTAILQ_REMOVE(&sc->segments, sg, list);
- free(sg);
+ LRU_Free(sg->lru);
+ FREE_OBJ(sg);
return;
}
--
1.7.9.5
More information about the varnish-dev
mailing list