about summary refs log tree commit diff stats
path: root/src/kilo.c
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-11-13 17:46:08 -0800
committerKartik K. Agaram <vc@akkartik.com>2021-11-13 17:46:08 -0800
commit12b2a44cf6413ef0c51c4e13af1c03369f9e803f (patch)
tree74126521afd4a7ab4320910f6886da6d5c156bc9 /src/kilo.c
parent398112f756f2944df6165a9e9c81c9e62618f3bf (diff)
downloadteliva-12b2a44cf6413ef0c51c4e13af1c03369f9e803f.tar.gz
stop leaking memory
Diffstat (limited to 'src/kilo.c')
-rw-r--r--src/kilo.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/kilo.c b/src/kilo.c
index 7ea4dd0..402ffcb 100644
--- a/src/kilo.c
+++ b/src/kilo.c
@@ -1172,8 +1172,9 @@ static void editorMoveCursor(int key) {
 extern void save_to_current_definition_and_editor_buffer(lua_State *L, char *name);
 extern void load_editor_buffer_to_current_definition_in_image(lua_State *L);
 extern void editorRefreshBuffer(void);
+#define CURRENT_DEFINITION_LEN 256
 static void editorGo(lua_State* L, int fd) {
-    char query[KILO_QUERY_LEN+1] = {0};
+    char query[CURRENT_DEFINITION_LEN+1] = {0};
     int qlen = 0;
 
     editorSaveToDisk();
@@ -1194,7 +1195,7 @@ static void editorGo(lua_State* L, int fd) {
             }
             return;
         } else if (isprint(c)) {
-            if (qlen < KILO_QUERY_LEN) {
+            if (qlen < CURRENT_DEFINITION_LEN) {
                 query[qlen++] = c;
                 query[qlen] = '\0';
             }