summaryrefslogtreecommitdiffstats
path: root/ssl/record
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2015-10-30 10:05:53 +0000
committerMatt Caswell <matt@openssl.org>2015-11-09 22:48:41 +0000
commita71edf3ba275b946224b5bcded0a8ecfce1855c0 (patch)
tree85257ad90882fc4d8d8f73cd91a03b7cc476b9d2 /ssl/record
parent3457e7a087a643cb65d67d9d72ec5983a02f5dfe (diff)
Standardise our style for checking malloc failures
if we have a malloc |x = OPENSSL_malloc(...)| sometimes we check |x| for NULL and sometimes we treat it as a boolean |if(!x) ...|. Standardise the approach in libssl. Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Diffstat (limited to 'ssl/record')
-rw-r--r--ssl/record/rec_layer_d1.c4
-rw-r--r--ssl/record/rec_layer_s3.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/ssl/record/rec_layer_d1.c b/ssl/record/rec_layer_d1.c
index 0133ae3f18..ebe486e419 100644
--- a/ssl/record/rec_layer_d1.c
+++ b/ssl/record/rec_layer_d1.c
@@ -137,8 +137,8 @@ int DTLS_RECORD_LAYER_new(RECORD_LAYER *rl)
d->processed_rcds.q = pqueue_new();
d->buffered_app_data.q = pqueue_new();
- if (!d->unprocessed_rcds.q || !d->processed_rcds.q
- || !d->buffered_app_data.q) {
+ if (d->unprocessed_rcds.q == NULL || d->processed_rcds.q == NULL
+ || d->buffered_app_data.q == NULL) {
pqueue_free(d->unprocessed_rcds.q);
pqueue_free(d->processed_rcds.q);
pqueue_free(d->buffered_app_data.q);
diff --git a/ssl/record/rec_layer_s3.c b/ssl/record/rec_layer_s3.c
index c9f1b712c8..ae31f5dd66 100644
--- a/ssl/record/rec_layer_s3.c
+++ b/ssl/record/rec_layer_s3.c
@@ -530,7 +530,7 @@ int ssl3_write_bytes(SSL *s, int type, const void *buf_, int len)
packlen *= 4;
wb->buf = OPENSSL_malloc(packlen);
- if (!wb->buf) {
+ if (wb->buf == NULL) {
SSLerr(SSL_F_SSL3_WRITE_BYTES, ERR_R_MALLOC_FAILURE);
return -1;
}