summaryrefslogtreecommitdiff
path: root/lib/libssl/bs_cbs.c
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
commit089248566d3c557bd78b4d2a043bb90d16ef6e1d (patch)
treead867f16f8ef46c9007b9372e05f19090781a989 /lib/libssl/bs_cbs.c
parentf7fbc89b37c0e508132deb5889547f4271f2fdf1 (diff)
free() can handle NULL.
ok jsing@
Diffstat (limited to 'lib/libssl/bs_cbs.c')
-rw-r--r--lib/libssl/bs_cbs.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/libssl/bs_cbs.c b/lib/libssl/bs_cbs.c
index d7c0977cf3f..25305b9edd2 100644
--- a/lib/libssl/bs_cbs.c
+++ b/lib/libssl/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);
}