diff options
author | nytpu <alex@nytpu.com> | 2021-06-04 16:19:51 -0600 |
---|---|---|
committer | nytpu <alex@nytpu.com> | 2021-06-04 16:19:51 -0600 |
commit | 12cbd9227bb26fdc8617093c63b4d077434cc35a (patch) | |
tree | c6c99b098ad1e7c01b8a24185ac40fcc9affd109 | |
parent | use one-indexing interally unless actually indexing rows array (diff) | |
download | ed-12cbd9227bb26fdc8617093c63b4d077434cc35a.tar.bz2 ed-12cbd9227bb26fdc8617093c63b4d077434cc35a.zip |
fix unfreed memory on q/Q command
-rw-r--r-- | main.c | 3 | ||||
-rw-r--r-- | test.txt | 10 |
2 files changed, 2 insertions, 11 deletions
@@ -91,7 +91,7 @@ main(int argc, char *argv[]) // DEBUG printf("#: %ld; c: %ld\n", E.numrows, E.crow); - char *line; + char *line = NULL; while ((line = linenoise(E.prompt_enabled ? E.prompt : "")) != NULL) { struct command cmd; int ret = parse_command(&cmd, line); @@ -114,6 +114,7 @@ main(int argc, char *argv[]) } // fallthrough case 'Q': + free(line); goto quit; default: error("Unknown command"); diff --git a/test.txt b/test.txt deleted file mode 100644 index f00c965..0000000 --- a/test.txt +++ /dev/null @@ -1,10 +0,0 @@ -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 |