diff options
Diffstat (limited to 'source4/lib')
-rw-r--r-- | source4/lib/registry/tools/regshell.c | 6 | ||||
-rw-r--r-- | source4/lib/smbreadline/smbreadline.c | 9 |
2 files changed, 12 insertions, 3 deletions
diff --git a/source4/lib/registry/tools/regshell.c b/source4/lib/registry/tools/regshell.c index 1c5157e937..329d6ab670 100644 --- a/source4/lib/registry/tools/regshell.c +++ b/source4/lib/registry/tools/regshell.c @@ -546,12 +546,16 @@ int main(int argc, char **argv) via readline :-( */ line = smb_readline(prompt, NULL, reg_completion); - if (line == NULL) + if (line == NULL) { + free(prompt); break; + } if (line[0] != '\n') { ret = W_ERROR_IS_OK(process_cmd(ctx, line)); } + free(line); + free(prompt); } talloc_free(ctx); diff --git a/source4/lib/smbreadline/smbreadline.c b/source4/lib/smbreadline/smbreadline.c index e5cc3522e9..a85f335b8a 100644 --- a/source4/lib/smbreadline/smbreadline.c +++ b/source4/lib/smbreadline/smbreadline.c @@ -77,13 +77,18 @@ static char *smb_readline_replacement(const char *prompt, void (*callback)(void) char **(completion_fn)(const char *text, int start, int end)) { fd_set fds; - static char line[1024]; + char *line; struct timeval timeout; int fd = STDIN_FILENO; char *ret; do_debug("%s", prompt); + line = (char *)malloc(BUFSIZ); + if (!line) { + return NULL; + } + while (1) { timeout.tv_sec = 5; timeout.tv_usec = 0; @@ -92,7 +97,7 @@ static char *smb_readline_replacement(const char *prompt, void (*callback)(void) FD_SET(fd,&fds); if (sys_select_intr(fd+1,&fds,NULL,NULL,&timeout) == 1) { - ret = x_fgets(line, sizeof(line), x_stdin); + ret = x_fgets(line, BUFSIZ, x_stdin); return ret; } if (callback) |