diff options
author | bapt <bapt@FreeBSD.org> | 2015-08-09 00:19:14 +0000 |
---|---|---|
committer | bapt <bapt@FreeBSD.org> | 2015-08-09 00:19:14 +0000 |
commit | d68017be3aa40615c000f0b0ac8ae1286b11dca8 (patch) | |
tree | 5a53ef190a7484b5fc3d49df25544f3aa6771265 /lib/libc/string | |
parent | 2c81d1658920f732f451e9edffa48cf9b90607b1 (diff) | |
download | FreeBSD-src-d68017be3aa40615c000f0b0ac8ae1286b11dca8.zip FreeBSD-src-d68017be3aa40615c000f0b0ac8ae1286b11dca8.tar.gz |
Fix typo
Remove useless tests before free()
Suggested by: jilles
Diffstat (limited to 'lib/libc/string')
-rw-r--r-- | lib/libc/string/strcoll.c | 14 | ||||
-rw-r--r-- | lib/libc/string/strxfrm.c | 8 |
2 files changed, 8 insertions, 14 deletions
diff --git a/lib/libc/string/strcoll.c b/lib/libc/string/strcoll.c index 5bad40c..7675e0a 100644 --- a/lib/libc/string/strcoll.c +++ b/lib/libc/string/strcoll.c @@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$"); /* - * In order to properly handle multibyte locales, its easiet to just + * In order to properly handle multibyte locales, its easiest to just * convert to wide characters and then use wcscoll. However if an * error occurs, we gracefully fall back to simple strcmp. Caller * should check errno. @@ -99,18 +99,14 @@ strcoll_l(const char *s, const char *s2, locale_t locale) goto error; ret = wcscoll_l(w1, w2, locale); - if (t1) - free(t1); - if (t2) - free(t2); + free(t1); + free(t2); return (ret); error: - if (t1) - free(t1); - if (t2) - free(t2); + free(t1); + free(t2); return (strcmp(s, s2)); } 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); } |