projects
/
open-adventure.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Stop leaking memory
[open-adventure.git]
/
main.c
diff --git
a/main.c
b/main.c
index 916ff0ac6931decc20f4c1298ca8020fd0588bec..61a2267a59b183f6879f132c9001493938888111 100644
(file)
--- a/
main.c
+++ b/
main.c
@@
-1029,6
+1029,8
@@
L2600:
/* This is where we get a new command from the user */
char* input;
/* This is where we get a new command from the user */
char* input;
+ char inputbuf[LINESIZE];
+
for (;;) {
input = get_input();
if (input == NULL)
for (;;) {
input = get_input();
if (input == NULL)
@@
-1040,8
+1042,12
@@
L2600:
if (strcmp(input, "") != 0)
break;
}
if (strcmp(input, "") != 0)
break;
}
+
+ strncpy(inputbuf, input, LINESIZE - 1);
+ linenoiseFree(input);
+
long tokens[4];
long tokens[4];
- tokenize(input, tokens);
+ tokenize(input
buf
, tokens);
command.wd1 = tokens[0];
command.wd1x = tokens[1];
command.wd2 = tokens[2];
command.wd1 = tokens[0];
command.wd1x = tokens[1];
command.wd2 = tokens[2];
@@
-1118,7
+1124,7
@@
Lookup:
defn = get_vocab_id(word1);
if (defn == -1) {
/* Gee, I don't understand. */
defn = get_vocab_id(word1);
if (defn == -1) {
/* Gee, I don't understand. */
- if (fallback_handler(input))
+ if (fallback_handler(input
buf
))
continue;
rspeak(DONT_KNOW, command.wd1, command.wd1x);
goto L2600;
continue;
rspeak(DONT_KNOW, command.wd1, command.wd1x);
goto L2600;