From d68017be3aa40615c000f0b0ac8ae1286b11dca8 Mon Sep 17 00:00:00 2001 From: bapt Date: Sun, 9 Aug 2015 00:19:14 +0000 Subject: Fix typo Remove useless tests before free() Suggested by: jilles --- lib/libc/string/strxfrm.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'lib/libc/string/strxfrm.c') 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); } -- cgit v1.1