Commit 4a149499 authored by Geoff Simmons's avatar Geoff Simmons

Fix VDP removal at vcl.discard.

parent 0d278dbd
...@@ -109,4 +109,5 @@ varnish v1 -vcl { backend b None; } ...@@ -109,4 +109,5 @@ varnish v1 -vcl { backend b None; }
# Tests oject finalization, freeing argv # Tests oject finalization, freeing argv
varnish v1 -cli "vcl.discard vcl1" varnish v1 -cli "vcl.discard vcl1"
varnish v1 -cli "vcl.discard vcl2" varnish v1 -cli "vcl.discard vcl2"
delay 1
varnish v1 -cli "vcl.list" varnish v1 -cli "vcl.list"
...@@ -142,4 +142,6 @@ varnish v1 -vcl { backend b None; } ...@@ -142,4 +142,6 @@ varnish v1 -vcl { backend b None; }
# Tests the discard event, with removal of VDPs. # Tests the discard event, with removal of VDPs.
varnish v1 -cli "vcl.discard vcl1" varnish v1 -cli "vcl.discard vcl1"
varnish v1 -cli "vcl.discard vcl2"
delay 1
varnish v1 -cli "vcl.list" varnish v1 -cli "vcl.list"
...@@ -479,12 +479,13 @@ vmod_event(VRT_CTX, struct vmod_priv *priv, enum vcl_event_e e) ...@@ -479,12 +479,13 @@ vmod_event(VRT_CTX, struct vmod_priv *priv, enum vcl_event_e e)
if (map->vcl == ctx->vcl && map->vdp != NULL) { if (map->vcl == ctx->vcl && map->vdp != NULL) {
VRT_RemoveVDP(ctx, map->vdp); VRT_RemoveVDP(ctx, map->vdp);
free(TRUST_ME(map->vdp)); free(TRUST_ME(map->vdp));
map->vdp = NULL;
prev_map = map; prev_map = map;
} }
map = VRBT_NEXT(vdp_tree, &tree_h, map); map = VRBT_NEXT(vdp_tree, &tree_h, map);
if (prev_map != NULL) { if (prev_map != NULL) {
VRBT_REMOVE(vdp_tree, &tree_h, map); VRBT_REMOVE(vdp_tree, &tree_h, prev_map);
FREE_OBJ(map); FREE_OBJ(prev_map);
} }
} }
return (0); return (0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment