Commit Diff


commit - 438d0cc30baf8e97fd870f5e620833e0a45401aa
commit + e087e1f6e7b926dcff23d90de416399c114d582e
blob - b58b1e7be0421dac9ff6c9717bacb59208ad1bbb
blob + 2d740d8c68ee194fe07fbfdcd32adc917ba70b44
--- gotwebd/gotwebd.h
+++ gotwebd/gotwebd.h
@@ -252,7 +252,7 @@ TAILQ_HEAD(addresslist, address);
 
 struct server {
 	TAILQ_ENTRY(server)	 entry;
-	struct addresslist	*al;
+	struct addresslist	al;
 
 	char		 name[GOTWEBD_MAXTEXT];
 
@@ -294,7 +294,7 @@ enum sock_type {
 };
 
 struct socket_conf {
-	struct addresslist	*al;
+	struct addresslist	al;
 
 	char		 name[GOTWEBD_MAXTEXT];
 	char		 srv_name[GOTWEBD_MAXTEXT];
blob - 748db3ece24e2a35e37196d7d1f2d8f1a3b071c8
blob + 6a19cc971eac7c808d5e66cf765ae45df9f34677
--- gotwebd/parse.y
+++ gotwebd/parse.y
@@ -227,7 +227,7 @@ server		: SERVER STRING {
 			new_srv = conf_new_server($2);
 			if (new_srv->fcgi_socket)
 				if (get_addrs(new_srv->fcgi_socket_bind,
-				    new_srv->al,
+				    &new_srv->al,
 				    new_srv->fcgi_socket_port) == -1) {
 					yyerror("could not get tcp iface "
 					    "addrs");
@@ -252,7 +252,7 @@ server		: SERVER STRING {
 			free($2);
 		} '{' optnl serveropts2 '}' {
 			if (get_addrs(new_srv->fcgi_socket_bind,
-			    new_srv->al, new_srv->fcgi_socket_port) == -1) {
+			    &new_srv->al, new_srv->fcgi_socket_port) == -1) {
 				yyerror("could not get tcp iface addrs");
 				YYERROR;
 			}
@@ -934,10 +934,7 @@ conf_new_server(const char *name)
 	srv->unix_socket = 1;
 	srv->fcgi_socket = gotwebd->fcgi_socket ? gotwebd->fcgi_socket : 0;
 
-	if ((srv->al = calloc(1, sizeof(*srv->al))) == NULL)
-		fatalx("%s: calloc", __func__);
-
-	TAILQ_INIT(srv->al);
+	TAILQ_INIT(&srv->al);
 	TAILQ_INSERT_TAIL(gotwebd->servers, srv, entry);
 	gotwebd->server_cnt++;
 
blob - cf2a3d1df8e8ab807643e41c0104908853476046
blob + b60e44674a3b5851bb5126437284adc08abea47d
--- gotwebd/sockets.c
+++ gotwebd/sockets.c
@@ -141,7 +141,7 @@ sockets_parse_sockets(struct gotwebd *env)
 			TAILQ_FOREACH(sock, env->sockets, entry) {
 				ipv4 = ipv6 = 0;
 
-				TAILQ_FOREACH(a, sock->conf.al, entry) {
+				TAILQ_FOREACH(a, &sock->conf.al, entry) {
 					if (a->ss.ss_family == AF_INET)
 						ipv4 = 1;
 					if (a->ss.ss_family == AF_INET6)
@@ -180,14 +180,12 @@ sockets_dup_new_socket(struct socket *p_sock, struct s
 	n = snprintf(sock->conf.name, GOTWEBD_MAXTEXT, "%s_child",
 	    p_sock->conf.srv_name);
 	if (n < 0 || (size_t)n >= GOTWEBD_MAXTEXT) {
-		free(p_sock->conf.al);
 		free(p_sock);
-		free(sock->conf.al);
 		free(sock);
 		fatalx("%s: snprintf", __func__);
 	}
 
-	TAILQ_FOREACH(a, p_sock->conf.al, entry) {
+	TAILQ_FOREACH(a, &p_sock->conf.al, entry) {
 		if (a->ss.ss_family == AF_INET)
 			continue;
 
@@ -205,7 +203,7 @@ sockets_dup_new_socket(struct socket *p_sock, struct s
 			}
 		}
 
-		TAILQ_INSERT_TAIL(sock->conf.al, acp, entry);
+		TAILQ_INSERT_TAIL(&sock->conf.al, acp, entry);
 	}
 }
 
@@ -220,11 +218,7 @@ sockets_conf_new_socket(struct gotwebd *env, struct se
 	if ((sock = calloc(1, sizeof(*sock))) == NULL)
 		fatalx("%s: calloc", __func__);
 
-	if ((sock->conf.al = calloc(1, sizeof(*sock->conf.al))) == NULL) {
-		free(sock);
-		fatalx("%s: calloc", __func__);
-	}
-	TAILQ_INIT(sock->conf.al);
+	TAILQ_INIT(&sock->conf.al);
 
 	sock->conf.parent_id = 0;
 	sock->conf.id = id;
@@ -238,7 +232,6 @@ sockets_conf_new_socket(struct gotwebd *env, struct se
 		    srv->unix_socket_name,
 		    sizeof(sock->conf.unix_socket_name)) >=
 		    sizeof(sock->conf.unix_socket_name)) {
-			free(sock->conf.al);
 			free(sock);
 			fatalx("%s: strlcpy", __func__);
 		}
@@ -253,21 +246,18 @@ sockets_conf_new_socket(struct gotwebd *env, struct se
 	n = snprintf(sock->conf.name, GOTWEBD_MAXTEXT, "%s_parent",
 	    srv->name);
 	if (n < 0 || (size_t)n >= GOTWEBD_MAXTEXT) {
-		free(sock->conf.al);
 		free(sock);
 		fatalx("%s: snprintf", __func__);
 	}
 
 	if (strlcpy(sock->conf.srv_name, srv->name,
 	    sizeof(sock->conf.srv_name)) >= sizeof(sock->conf.srv_name)) {
-		free(sock->conf.al);
 		free(sock);
 		fatalx("%s: strlcpy", __func__);
 	}
 
-	TAILQ_FOREACH(a, srv->al, entry) {
+	TAILQ_FOREACH(a, &srv->al, entry) {
 		if ((acp = calloc(1, sizeof(*acp))) == NULL) {
-			free(sock->conf.al);
 			free(sock);
 			fatal("%s: calloc", __func__);
 		}
@@ -283,7 +273,7 @@ sockets_conf_new_socket(struct gotwebd *env, struct se
 			}
 		}
 
-		TAILQ_INSERT_TAIL(sock->conf.al, acp, entry);
+		TAILQ_INSERT_TAIL(&sock->conf.al, acp, entry);
 	}
 done:
 	return (sock);
@@ -437,7 +427,7 @@ sockets_privinit(struct gotwebd *env, struct socket *s
 	if (sock->conf.type == FCGI) {
 		log_debug("%s: initializing fcgi socket for %s", __func__,
 		    sock->conf.name);
-		sock->fd = sockets_create_socket(sock->conf.al,
+		sock->fd = sockets_create_socket(&sock->conf.al,
 		    sock->conf.fcgi_socket_port);
 		if (sock->fd == -1) {
 			log_warnx("%s: create unix socket failed", __func__);