From d0afd4f304d5479be7371eb779f1901742be3eb1 Mon Sep 17 00:00:00 2001 From: Arthur Barraux Date: Tue, 13 Jan 2026 15:20:18 +0100 Subject: [PATCH] patch file_completion crash --- src/input.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/input.c b/src/input.c index e092b8e..8843394 100644 --- a/src/input.c +++ b/src/input.c @@ -50,7 +50,7 @@ const char *file_completion(const char *path) { if (last_slash) { dir_len = last_slash - path + 1; // length of dir_path strncpy(directory, path, dir_len); - predict_len = strlen(path) - dir_len - 1; + predict_len = strlen(path) - dir_len; strncpy(predict, last_slash + 1, predict_len); directory[dir_len] = '\0'; predict[predict_len] = '\0'; @@ -73,9 +73,7 @@ const char *file_completion(const char *path) { strcat(full_path, "/"); // add slash for directories } closedir(dir); - dir = NULL; - free(entry); - + return strdup(full_path); } }