summaryrefslogtreecommitdiff
path: root/lib/libssl
diff options
context:
space:
mode:
authorDoug Hogan <doug@cvs.openbsd.org>2015-04-29 01:16:07 +0000
committerDoug Hogan <doug@cvs.openbsd.org>2015-04-29 01:16:07 +0000
commit14f8eed5b79d578d9ecf118ca2fe592aa9bec52d (patch)
treeb785e2d7c4dd448423f11661012b1d630178d21f /lib/libssl
parent8471020974e8f514d8ac74114c6ef90abc7164c4 (diff)
free() can handle NULL.
ok jsing@
Diffstat (limited to 'lib/libssl')
-rw-r--r--lib/libssl/src/ssl/bs_cbs.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/libssl/src/ssl/bs_cbs.c b/lib/libssl/src/ssl/bs_cbs.c
index d7c0977cf3f..25305b9edd2 100644
--- a/lib/libssl/src/ssl/bs_cbs.c
+++ b/lib/libssl/src/ssl/bs_cbs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bs_cbs.c,v 1.3 2015/04/25 15:28:47 doug Exp $ */
+/* $OpenBSD: bs_cbs.c,v 1.4 2015/04/29 01:16:06 doug Exp $ */
/*
* Copyright (c) 2014, Google Inc.
*
@@ -65,10 +65,8 @@ CBS_len(const CBS *cbs)
int
CBS_stow(const CBS *cbs, uint8_t **out_ptr, size_t *out_len)
{
- if (*out_ptr != NULL) {
- free(*out_ptr);
- *out_ptr = NULL;
- }
+ free(*out_ptr);
+ *out_ptr = NULL;
*out_len = 0;
if (cbs->len == 0)
@@ -85,9 +83,7 @@ CBS_stow(const CBS *cbs, uint8_t **out_ptr, size_t *out_len)
int
CBS_strdup(const CBS *cbs, char **out_ptr)
{
- if (*out_ptr != NULL)
- free(*out_ptr);
-
+ free(*out_ptr);
*out_ptr = strndup((const char*)cbs->data, cbs->len);
return (*out_ptr != NULL);
}