Memset 0 server in addition to client

This commit is contained in:
Quentin Dufour 2019-02-19 14:57:25 +01:00
parent a4c3018c79
commit 4a4611f20d

View file

@ -68,6 +68,7 @@ void serv_init_udp_socket(char* port, struct donar_server_ctx* ctx) {
fdinfo.cat->name = "udp-read";
fdinfo.other = malloc(sizeof(struct udp_target));
if (fdinfo.other == NULL) goto socket_failed;
memset(fdinfo.other, 0, sizeof(struct udp_target));
sprintf(fdinfo.url, "udp:read:127.0.0.1:%s", port);
evt_core_add_fd (&(ctx->evts), &fdinfo);
@ -75,6 +76,7 @@ void serv_init_udp_socket(char* port, struct donar_server_ctx* ctx) {
fdinfo.cat->name = "udp-write";
fdinfo.other = malloc(sizeof(struct udp_target));
if (fdinfo.other == NULL) goto socket_failed;
memset(fdinfo.other, 0, sizeof(struct udp_target));
sprintf(fdinfo.url, "udp:write:127.0.0.1:%s", port);
evt_core_add_fd (&(ctx->evts), &fdinfo);