summaryrefslogtreecommitdiff
path: root/lib/libc/time
diff options
context:
space:
mode:
authormmcc <mmcc@cvs.openbsd.org>2015-12-25 19:10:30 +0000
committermmcc <mmcc@cvs.openbsd.org>2015-12-25 19:10:30 +0000
commit45e248037d36e421668dc219051d877e00baedb5 (patch)
tree08998d0cf5faaa28f6dc2850f15234c5a21f0cf1 /lib/libc/time
parent4e49d29ef25ced3d9f0dbfd3409e20e4add40c51 (diff)
Simplify allocation logic based on free and realloc's behavior on NULL.
ok tedu@
Diffstat (limited to 'lib/libc/time')
-rw-r--r--lib/libc/time/strftime.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/libc/time/strftime.c b/lib/libc/time/strftime.c
index aea2e2f8e6b..5958000b460 100644
--- a/lib/libc/time/strftime.c
+++ b/lib/libc/time/strftime.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: strftime.c,v 1.28 2015/10/24 18:13:18 guenther Exp $ */
+/* $OpenBSD: strftime.c,v 1.29 2015/12/25 19:10:29 mmcc Exp $ */
/*
** Copyright (c) 1989, 1993
** The Regents of the University of California. All rights reserved.
@@ -670,10 +670,9 @@ _loc(void)
goto bad_locale;
bufsize = namesize + st.st_size;
locale_buf = NULL;
- nlbuf = (lbuf == NULL) ? malloc(bufsize) : realloc(lbuf, bufsize);
+ nlbuf = realloc(lbuf, bufsize);
if (nlbuf == NULL) {
- if (lbuf)
- free(lbuf);
+ free(lbuf);
lbuf = NULL;
goto bad_locale;
}