summaryrefslogtreecommitdiff
path: root/lib/libc/db/hash/hash_bigkey.c
diff options
context:
space:
mode:
authormmcc <mmcc@cvs.openbsd.org>2015-12-28 22:08:19 +0000
committermmcc <mmcc@cvs.openbsd.org>2015-12-28 22:08:19 +0000
commit2b7e45a9f71e83195c6a0adf68237584f51e58a7 (patch)
tree8318880361e05bcfcbf5d545011888bf0e7d43e3 /lib/libc/db/hash/hash_bigkey.c
parentca0f93cf7f05b71a14ee9ed66e06416c9ff657ba (diff)
Remove NULL-checks before free() and a few related dead assignments.
ok and valuable input from millert@
Diffstat (limited to 'lib/libc/db/hash/hash_bigkey.c')
-rw-r--r--lib/libc/db/hash/hash_bigkey.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/libc/db/hash/hash_bigkey.c b/lib/libc/db/hash/hash_bigkey.c
index 18682cc1b28..c98165432ba 100644
--- a/lib/libc/db/hash/hash_bigkey.c
+++ b/lib/libc/db/hash/hash_bigkey.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hash_bigkey.c,v 1.18 2015/01/16 16:48:51 deraadt Exp $ */
+/* $OpenBSD: hash_bigkey.c,v 1.19 2015/12/28 22:08:18 mmcc Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@@ -452,8 +452,7 @@ collect_data(HTAB *hashp, BUFHEAD *bufp, int len, int set)
if (bp[2] == FULL_KEY_DATA) { /* End of Data */
totlen = len + mylen;
- if (hashp->tmp_buf)
- free(hashp->tmp_buf);
+ free(hashp->tmp_buf);
if ((hashp->tmp_buf = (char *)malloc(totlen)) == NULL)
return (-1);
if (set) {
@@ -518,8 +517,7 @@ collect_key(HTAB *hashp, BUFHEAD *bufp, int len, DBT *val, int set)
save_addr = bufp->addr;
totlen = len + mylen;
if (bp[2] == FULL_KEY || bp[2] == FULL_KEY_DATA) { /* End of Key. */
- if (hashp->tmp_key != NULL)
- free(hashp->tmp_key);
+ free(hashp->tmp_key);
if ((hashp->tmp_key = (char *)malloc(totlen)) == NULL)
return (-1);
if (__big_return(hashp, bufp, 1, val, set))