summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2015-09-13 13:44:08 +0000
committerBob Beck <beck@cvs.openbsd.org>2015-09-13 13:44:08 +0000
commitddcc71ef430cd13fd2eba101c624e79033c0a4de (patch)
tree833dab2f9b085d457f190b003963966bfa167c84 /lib
parent5bc858f7c2fad8c213f6828ea8a674e0f9cd506f (diff)
Don't leak conninfo - spotted by marko kreen.
ok jsing@
Diffstat (limited to 'lib')
-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)