summaryrefslogtreecommitdiff
path: root/lib/libc/stdio/vfwprintf.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/stdio/vfwprintf.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/stdio/vfwprintf.c')
-rw-r--r--lib/libc/stdio/vfwprintf.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/lib/libc/stdio/vfwprintf.c b/lib/libc/stdio/vfwprintf.c
index be83aabe7ef..520c8bc7d22 100644
--- a/lib/libc/stdio/vfwprintf.c
+++ b/lib/libc/stdio/vfwprintf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfwprintf.c,v 1.14 2015/09/29 03:19:24 guenther Exp $ */
+/* $OpenBSD: vfwprintf.c,v 1.15 2015/12/28 22:08:18 mmcc Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
@@ -667,10 +667,7 @@ reswitch: switch (ch) {
prec = dtoaend - dtoaresult;
if (expt == INT_MAX)
ox[1] = '\0';
- if (convbuf) {
- free(convbuf);
- convbuf = NULL;
- }
+ free(convbuf);
cp = convbuf = __mbsconv(dtoaresult, -1);
if (cp == NULL)
goto error;
@@ -719,10 +716,7 @@ fp_begin:
if (expt == 9999)
expt = INT_MAX;
}
- if (convbuf) {
- free(convbuf);
- convbuf = NULL;
- }
+ free(convbuf);
cp = convbuf = __mbsconv(dtoaresult, -1);
if (cp == NULL)
goto error;
@@ -828,10 +822,7 @@ fp_common:
char *mbsarg;
if ((mbsarg = GETARG(char *)) == NULL)
mbsarg = "(null)";
- if (convbuf) {
- free(convbuf);
- convbuf = NULL;
- }
+ free(convbuf);
convbuf = __mbsconv(mbsarg, prec);
if (convbuf == NULL) {
fp->_flags |= __SERR;
@@ -1047,8 +1038,7 @@ overflow:
ret = -1;
finish:
- if (convbuf)
- free(convbuf);
+ free(convbuf);
#ifdef FLOATING_POINT
if (dtoaresult)
__freedtoa(dtoaresult);