summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorjsing <>2016-11-04 15:45:55 +0000
committerjsing <>2016-11-04 15:45:55 +0000
commita095fd48b5773625cbe19b8a6c4d85902eafec6d (patch)
tree52dc0e2a3d1075bac3c17172233e296d812e17af /src/lib
parenta233f690183a59be9ea1140342c786895b018256 (diff)
downloadopenbsd-a095fd48b5773625cbe19b8a6c4d85902eafec6d.tar.gz
openbsd-a095fd48b5773625cbe19b8a6c4d85902eafec6d.tar.bz2
openbsd-a095fd48b5773625cbe19b8a6c4d85902eafec6d.zip
Assign and test, as is consistent with the rest of the libtls code.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libtls/tls_bio_cb.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/lib/libtls/tls_bio_cb.c b/src/lib/libtls/tls_bio_cb.c
index 478bc1e614..28eba24c91 100644
--- a/src/lib/libtls/tls_bio_cb.c
+++ b/src/lib/libtls/tls_bio_cb.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls_bio_cb.c,v 1.13 2016/11/04 15:43:46 jsing Exp $ */ 1/* $OpenBSD: tls_bio_cb.c,v 1.14 2016/11/04 15:45:55 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2016 Tobias Pape <tobias@netshed.de> 3 * Copyright (c) 2016 Tobias Pape <tobias@netshed.de>
4 * 4 *
@@ -59,8 +59,7 @@ bio_cb_new(BIO *bio)
59{ 59{
60 struct bio_cb *bcb; 60 struct bio_cb *bcb;
61 61
62 bcb = calloc(1, sizeof(struct bio_cb)); 62 if ((bcb = calloc(1, sizeof(struct bio_cb))) == NULL)
63 if (bcb == NULL)
64 return (0); 63 return (0);
65 64
66 bio->shutdown = 1; 65 bio->shutdown = 1;
@@ -180,8 +179,7 @@ tls_get_new_cb_bio(struct tls *ctx)
180 if (ctx->read_cb == NULL || ctx->write_cb == NULL) 179 if (ctx->read_cb == NULL || ctx->write_cb == NULL)
181 tls_set_errorx(ctx, "no callbacks registered"); 180 tls_set_errorx(ctx, "no callbacks registered");
182 181
183 bio = BIO_new(bio_s_cb()); 182 if ((bio = BIO_new(bio_s_cb())) == NULL) {
184 if (bio == NULL) {
185 tls_set_errorx(ctx, "failed to create callback i/o"); 183 tls_set_errorx(ctx, "failed to create callback i/o");
186 return (NULL); 184 return (NULL);
187 } 185 }
@@ -205,8 +203,7 @@ tls_set_cbs(struct tls *ctx, tls_read_cb read_cb, tls_write_cb write_cb,
205 ctx->write_cb = write_cb; 203 ctx->write_cb = write_cb;
206 ctx->cb_arg = cb_arg; 204 ctx->cb_arg = cb_arg;
207 205
208 bio = tls_get_new_cb_bio(ctx); 206 if ((bio = tls_get_new_cb_bio(ctx)) == NULL) {
209 if (bio == NULL) {
210 tls_set_errorx(ctx, "failed to create callback i/o"); 207 tls_set_errorx(ctx, "failed to create callback i/o");
211 goto err; 208 goto err;
212 } 209 }