summaryrefslogtreecommitdiffstats
path: root/lib/libc/string/strxfrm.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/string/strxfrm.c')
-rw-r--r--lib/libc/string/strxfrm.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/libc/string/strxfrm.c b/lib/libc/string/strxfrm.c
index 8b25b0e..06ae639 100644
--- a/lib/libc/string/strxfrm.c
+++ b/lib/libc/string/strxfrm.c
@@ -84,8 +84,7 @@ strxfrm_l(char * __restrict dest, const char * __restrict src, size_t len, local
if ((xlen = _collate_sxfrm(table, wcs, dest, len)) == (size_t)-1)
goto error;
- if (wcs)
- free(wcs);
+ free(wcs);
if (len > xlen) {
dest[xlen] = 0;
@@ -97,9 +96,8 @@ strxfrm_l(char * __restrict dest, const char * __restrict src, size_t len, local
error:
/* errno should be set to ENOMEM if malloc failed */
- if (wcs)
- free(wcs);
- (void) strlcpy(dest, src, len);
+ free(wcs);
+ strlcpy(dest, src, len);
return (slen);
}
OpenPOWER on IntegriCloud