summaryrefslogtreecommitdiffstats
path: root/lib/libtls/tls.c
diff options
context:
space:
mode:
authorbeck <beck@openbsd.org>2015-09-13 13:44:07 +0000
committerbeck <beck@openbsd.org>2015-09-13 13:44:07 +0000
commitfd9ac1c5355ac463747bb3a84bce777dcbd4549b (patch)
tree0bf283567180139fcfabb78cd8848c45ae6121b0 /lib/libtls/tls.c
parentAdd copy-mode -e to exit copy mode when scrolling off the bottom, useful (diff)
downloadwireguard-openbsd-fd9ac1c5355ac463747bb3a84bce777dcbd4549b.tar.xz
wireguard-openbsd-fd9ac1c5355ac463747bb3a84bce777dcbd4549b.zip
Don't leak conninfo - spotted by marko kreen.
ok jsing@
Diffstat (limited to 'lib/libtls/tls.c')
-rw-r--r--lib/libtls/tls.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libtls/tls.c b/lib/libtls/tls.c
index 277970c932e..4f89a40be49 100644
--- a/lib/libtls/tls.c
+++ b/lib/libtls/tls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tls.c,v 1.27 2015/09/12 21:00:38 beck Exp $ */
+/* $OpenBSD: tls.c,v 1.28 2015/09/13 13:44:07 beck Exp $ */
/*
* Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
*
@@ -380,7 +380,8 @@ tls_handshake(struct tls *ctx)
{
int rv = -1;
- if ((ctx->conninfo = calloc(1, sizeof(*ctx->conninfo))) == NULL)
+ if (ctx->conninfo == NULL &&
+ (ctx->conninfo = calloc(1, sizeof(*ctx->conninfo))) == NULL)
goto out;
if ((ctx->flags & TLS_CLIENT) != 0)