summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2015-09-14 18:52:41 +0000
committerdelphij <delphij@FreeBSD.org>2015-09-14 18:52:41 +0000
commit3908360148557bd45707eb4f4eba0d4a78d72f64 (patch)
treeb6a48e754a3eb132c999839a4bf2418345d38648 /usr.bin
parente9fb7da04057e108c4d9e5461d1679dfd86b34d2 (diff)
downloadFreeBSD-src-3908360148557bd45707eb4f4eba0d4a78d72f64.zip
FreeBSD-src-3908360148557bd45707eb4f4eba0d4a78d72f64.tar.gz
MFC r287319:
Constify opt_f and opt_t and eliminate unneeded copying. This fixes memory leaks. Reported by: clang static analyzer
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/iconv/iconv.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/iconv/iconv.c b/usr.bin/iconv/iconv.c
index 494aaf7..161b22e 100644
--- a/usr.bin/iconv/iconv.c
+++ b/usr.bin/iconv/iconv.c
@@ -156,11 +156,11 @@ int
main(int argc, char **argv)
{
FILE *fp;
- char *opt_f, *opt_t;
+ const char *opt_f, *opt_t;
int ch, i, res;
bool opt_c = false, opt_s = false;
- opt_f = opt_t = strdup("");
+ opt_f = opt_t = "";
setlocale(LC_ALL, "");
setprogname(argv[0]);
@@ -186,12 +186,12 @@ main(int argc, char **argv)
case 'f':
/* from */
if (optarg != NULL)
- opt_f = strdup(optarg);
+ opt_f = optarg;
break;
case 't':
/* to */
if (optarg != NULL)
- opt_t = strdup(optarg);
+ opt_t = optarg;
break;
default:
usage();
OpenPOWER on IntegriCloud