[master] f65f7148c vcc_acl: Create template acl_e on the stack

Nils Goroll nils.goroll at uplex.de
Sat Mar 27 13:40:07 UTC 2021


commit f65f7148c6a6d27e973acf62fc9e12480a0e076a
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Sat Mar 27 14:20:56 2021 +0100

    vcc_acl: Create template acl_e on the stack
    
    We only ever insert copies into the tree in vcc_acl_add_entry()

diff --git a/lib/libvcc/vcc_acl.c b/lib/libvcc/vcc_acl.c
index 6f6591d7d..127b92adb 100644
--- a/lib/libvcc/vcc_acl.c
+++ b/lib/libvcc/vcc_acl.c
@@ -350,10 +350,10 @@ vcc_acl_try_netnotation(struct vcc *tl, struct acl_e *ae)
 static void
 vcc_acl_entry(struct vcc *tl)
 {
-	struct acl_e *ae;
+	struct acl_e ae[1];
 	char *sl, *e;
 
-	ALLOC_OBJ(ae, VCC_ACL_E_MAGIC);
+	INIT_OBJ(ae, VCC_ACL_E_MAGIC);
 
 	if (tl->t->tok == '!') {
 		ae->not = 1;
@@ -385,14 +385,12 @@ vcc_acl_entry(struct vcc *tl)
 		if (*e != '\0') {
 			VSB_cat(tl->sb, ".../mask is not numeric.\n");
 			vcc_ErrWhere(tl, ae->t_addr);
-			FREE_OBJ(ae);
 			return;
 		}
 		ae->t_mask = ae->t_addr;
 		if (tl->t->tok == '/') {
 			VSB_cat(tl->sb, "/mask only allowed once.\n");
 			vcc_ErrWhere(tl, tl->t);
-			FREE_OBJ(ae);
 			return;
 		}
 	} else if (tl->t->tok == '/') {


More information about the varnish-commit mailing list