summaryrefslogtreecommitdiff
path: root/usr.bin/less
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/less')
-rw-r--r--usr.bin/less/ch.c1
-rw-r--r--usr.bin/less/optfunc.c3
2 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/less/ch.c b/usr.bin/less/ch.c
index 58f08d3deb1..6c4bae2df63 100644
--- a/usr.bin/less/ch.c
+++ b/usr.bin/less/ch.c
@@ -366,6 +366,7 @@ end_logfile(void)
}
close(logfile);
logfile = -1;
+ free(namelogfile);
namelogfile = NULL;
}
diff --git a/usr.bin/less/optfunc.c b/usr.bin/less/optfunc.c
index ddd3712320b..2c0b81f1401 100644
--- a/usr.bin/less/optfunc.c
+++ b/usr.bin/less/optfunc.c
@@ -71,7 +71,7 @@ opt_o(int type, char *s)
}
switch (type) {
case INIT:
- namelogfile = s;
+ namelogfile = estrdup(s);
break;
case TOGGLE:
if (ch_getflags() & CH_CANSEEK) {
@@ -83,6 +83,7 @@ opt_o(int type, char *s)
return;
}
s = skipsp(s);
+ free(namelogfile);
namelogfile = lglob(s);
use_logfile(namelogfile);
sync_logfile();