From 2b5bf0bada1b51fa4c05248bc69eff12ace0aa09 Mon Sep 17 00:00:00 2001 From: Aaron Jones Date: Fri, 16 Sep 2016 21:54:53 +0000 Subject: [PATCH] GNUTLS: Improve rb_connect_tcp_ssl() and rb_ssl_start_connected() Use the variable name instead of its type as an argument to a sizeof allocation. This will prevent possible future errors being introduced when the type of the variable is changed, but the sizeof argument is not updated. --- libratbox/src/gnutls.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libratbox/src/gnutls.c b/libratbox/src/gnutls.c index eb4cdaac..74bce812 100644 --- a/libratbox/src/gnutls.c +++ b/libratbox/src/gnutls.c @@ -673,7 +673,7 @@ rb_connect_tcp_ssl(rb_fde_t *const F, struct sockaddr *const dest, struct sockad if(F == NULL) return; - struct ssl_connect *const sconn = rb_malloc(sizeof(struct ssl_connect)); + struct ssl_connect *const sconn = rb_malloc(sizeof *sconn); sconn->data = data; sconn->callback = callback; sconn->timeout = timeout; @@ -687,7 +687,7 @@ rb_ssl_start_connected(rb_fde_t *const F, CNCB *const callback, void *const data if(F == NULL) return; - struct ssl_connect *const sconn = rb_malloc(sizeof(struct ssl_connect)); + struct ssl_connect *const sconn = rb_malloc(sizeof *sconn); sconn->data = data; sconn->callback = callback; sconn->timeout = timeout;