about summary refs log tree commit diff stats
path: root/src/lua.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lua.c')
-rw-r--r--src/lua.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lua.c b/src/lua.c
index 8796ca7..f226828 100644
--- a/src/lua.c
+++ b/src/lua.c
@@ -304,9 +304,10 @@ static int handle_image (lua_State *L, char **argv, int n) {
 }
 
 
-const char *Current_definition = NULL;
+#define CURRENT_DEFINITION_LEN 256
+char Current_definition[CURRENT_DEFINITION_LEN+1] = {0};
 void save_to_current_definition_and_editor_buffer (lua_State *L, const char *definition) {
-    Current_definition = strdup(definition);
+    strncpy(Current_definition, definition, CURRENT_DEFINITION_LEN);
     lua_getglobal(L, "teliva_program");
     lua_getfield(L, -1, Current_definition);
     const char *contents = lua_tostring(L, -1);