[master] f4fdc0238 Allocate rss on the stack

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Thu Feb 20 20:31:11 UTC 2020


commit f4fdc0238c0cc44e38d0215dabe98c32a2c06c78
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Thu Feb 20 20:46:56 2020 +0100

    Allocate rss on the stack

diff --git a/lib/libvcc/vcc_utils.c b/lib/libvcc/vcc_utils.c
index ea38f69f3..efe8f4861 100644
--- a/lib/libvcc/vcc_utils.c
+++ b/lib/libvcc/vcc_utils.c
@@ -199,7 +199,7 @@ Resolve_Sockaddr(struct vcc *tl,
     const char *errid)
 {
 	int error;
-	struct rss *rss;
+	struct rss rss[1];
 	const char *err;
 
 	*ipv4 = NULL;
@@ -207,8 +207,7 @@ Resolve_Sockaddr(struct vcc *tl,
 	if (p_ascii != NULL)
 		*p_ascii = NULL;
 
-	ALLOC_OBJ(rss, RSS_MAGIC);
-	AN(rss);
+	INIT_OBJ(rss, RSS_MAGIC);
 	rss->vsb = VSB_new_auto();
 	AN(rss->vsb);
 
@@ -224,7 +223,7 @@ Resolve_Sockaddr(struct vcc *tl,
 		free(rss->vsa4);
 		free(rss->vsa6);
 		VSB_destroy(&rss->vsb);
-		FREE_OBJ(rss);
+		ZERO_OBJ(rss, sizeof rss);
 		return;
 	}
 	AZ(error);
@@ -255,7 +254,7 @@ Resolve_Sockaddr(struct vcc *tl,
 		vcc_ErrWhere(tl, t_err);
 	}
 	VSB_destroy(&rss->vsb);
-	FREE_OBJ(rss);
+	ZERO_OBJ(rss, sizeof rss);
 }
 
 /*


More information about the varnish-commit mailing list