From c9f1e38a85462f6579b4d9001a4244b967ca9ffe Mon Sep 17 00:00:00 2001 From: Xin LI Date: Mon, 22 Jun 2009 21:49:55 +0000 Subject: [PATCH] free(3) won't mess with errno so return it as-is. Submitted by: Jaakko Heinonen --- lib/libkiconv/kiconv_sysctl.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/libkiconv/kiconv_sysctl.c b/lib/libkiconv/kiconv_sysctl.c index 0030f4dac19b..7eebf2b4e0c7 100644 --- a/lib/libkiconv/kiconv_sysctl.c +++ b/lib/libkiconv/kiconv_sysctl.c @@ -39,7 +39,6 @@ int kiconv_lookupconv(const char *drvname) { size_t size; - int error; if (sysctlbyname("kern.iconv.drvlist", NULL, &size, NULL, 0) == -1) return (errno); @@ -50,7 +49,6 @@ kiconv_lookupconv(const char *drvname) if (drivers == NULL) return (ENOMEM); if (sysctlbyname("kern.iconv.drvlist", drivers, &size, NULL, 0) == -1) { - error = errno; free(drivers); return (errno); } @@ -68,7 +66,6 @@ kiconv_lookupcs(const char *tocode, const char *fromcode) { size_t i, size; struct iconv_cspair_info *csi, *csip; - int error; if (sysctlbyname("kern.iconv.cslist", NULL, &size, NULL, 0) == -1) return (errno); @@ -77,9 +74,8 @@ kiconv_lookupcs(const char *tocode, const char *fromcode) if (csi == NULL) return (ENOMEM); if (sysctlbyname("kern.iconv.cslist", csi, &size, NULL, 0) == -1) { - error = errno; free(csi); - return (error); + return (errno); } for (i = 0, csip = csi; i < (size/sizeof(*csi)); i++, csip++){ if (strcmp(csip->cs_to, tocode) == 0 &&