just 'print -c' outputs not even a newline; plug a memleak while here

This commit is contained in:
tg 2016-11-11 20:53:15 +00:00
parent 2f63478bc9
commit 26689a7c81

13
funcs.c
View File

@ -38,7 +38,7 @@
#endif
#endif
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.314 2016/11/11 20:14:17 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.315 2016/11/11 20:53:15 tg Exp $");
#if HAVE_KILLPG
/*
@ -449,12 +449,17 @@ c_print(const char **wp)
wp += builtin_opt.optind;
}
if (po.col) {
if (*wp == NULL)
return (0);
XPinit(words, 16);
}
Xinit(xs, xp, 128, ATEMP);
if (*wp == NULL)
goto print_no_arg;
if (po.col)
XPinit(words, 16);
print_read_arg:
if (po.chars) {
while (*wp != NULL) {
@ -548,7 +553,6 @@ c_print(const char **wp)
if (po.hist) {
Xput(xs, xp, '\0');
histsave(&source->line, Xstring(xs, xp), HIST_STORE, false);
Xfree(xs, xp);
} else {
size_t len = Xlength(xs, xp);
@ -588,6 +592,7 @@ c_print(const char **wp)
if (po.copipe)
restore_pipe();
}
Xfree(xs, xp);
return (c);
}