From 90eb2a6d56a4287410fd5d2717e70d01e80c9a3d Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Wed, 31 Dec 2008 18:21:29 +0000 Subject: removed useless malloc for cipher_t --- src/uanytun.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/uanytun.c') diff --git a/src/uanytun.c b/src/uanytun.c index 1225690..c2f5585 100644 --- a/src/uanytun.c +++ b/src/uanytun.c @@ -69,11 +69,11 @@ int main_loop(tun_device_t* dev, udp_socket_t* sock, options_t* opt) seq_nr_t seq_nr = 0; fd_set readfds; - cipher_t* c; - cipher_init(&c, opt->cipher_); - if(!c) { + cipher_t c; + int ret = cipher_init(&c, opt->cipher_); + if(ret) { log_printf(ERR, "could not initialize cipher of type %s", opt->cipher_); - return_value -1; + return_value = ret; } seq_win_t* seq_win; @@ -122,7 +122,7 @@ int main_loop(tun_device_t* dev, udp_socket_t* sock, options_t* opt) else plain_packet_set_type(&plain_packet, PAYLOAD_TYPE_UNKNOWN); - cipher_encrypt(c, &plain_packet, &encrypted_packet, seq_nr, opt->sender_id_, opt->mux_); + cipher_encrypt(&c, &plain_packet, &encrypted_packet, seq_nr, opt->sender_id_, opt->mux_); seq_nr++; // TODO: add auth-tag @@ -165,7 +165,7 @@ int main_loop(tun_device_t* dev, udp_socket_t* sock, options_t* opt) free(addrstring); } - cipher_decrypt(c, &encrypted_packet, &plain_packet); + cipher_decrypt(&c, &encrypted_packet, &plain_packet); len = tun_write(dev, plain_packet_get_payload(&plain_packet), plain_packet_get_payload_length(&plain_packet)); if(len == -1) -- cgit v1.2.3