[prev in list] [next in list] [prev in thread] [next in thread] 

List:       varnish-commit
Subject:    [master] 4edaa2836 Use FREE_OBJ for VEV
From:       Dridi Boukelmoune <dridi.boukelmoune () gmail ! com>
Date:       2019-03-22 7:35:08
Message-ID: 20190322073508.8C417A9995 () lists ! varnish-cache ! org
[Download RAW message or body]


commit 4edaa2836c6aba837899b78866a2567c704e336b
Author: Dridi Boukelmoune <dridi.boukelmoune@gmail.com>
Date:   Fri Mar 22 08:24:38 2019 +0100

    Use FREE_OBJ for VEV
    
    This was actually done with a Coccinelle patch after finding plain
    free() calls out of tree:
    
        $ cat >free_obj.cocci <<EOF
        @@
        expression obj, objp, magic;
        @@
    
        (
        TAKE_OBJ_NOTNULL(obj, objp, magic);
        |
        CAST_OBJ_NOTNULL(obj, objp, magic);
        |
        CHECK_OBJ_NOTNULL(obj, magic);
        |
        CHECK_OBJ_ORNULL(obj, magic);
        |
        CHECK_OBJ(obj, magic);
        )
        ...
        - free(obj);
        + FREE_OBJ(obj);
        $ spatch --dir . --in-place --sp-file free_obj.cocci
    
    Asking again, could we consider keeping Coccinelle patches around?

diff --git a/lib/libvarnish/vev.c b/lib/libvarnish/vev.c
index 7869f700f..dcb712a2e 100644
--- a/lib/libvarnish/vev.c
+++ b/lib/libvarnish/vev.c
@@ -222,9 +222,8 @@ VEV_Destroy(struct vev_root **evbp)
 	assert(evb->thread == pthread_self());
 	free(evb->pfd);
 	free(evb->pev);
-	/* destroy evb->binheap */
-	evb->magic = 0;
-	free(evb);
+	/* XXX: destroy evb->binheap */
+	FREE_OBJ(evb);
 }
 
 /*--------------------------------------------------------------------*/
_______________________________________________
varnish-commit mailing list
varnish-commit@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic