From 12d8930b2b328754297a304179fda94b7ba17c19 Mon Sep 17 00:00:00 2001 From: Slendi Date: Sun, 27 Jul 2025 21:30:47 +0300 Subject: [PATCH] Remove VLA, optional in later C versions Signed-off-by: Slendi --- src/dcfg.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/dcfg.c b/src/dcfg.c index 9b4dec1..a5518b3 100644 --- a/src/dcfg.c +++ b/src/dcfg.c @@ -1105,11 +1105,12 @@ Value *ast_to_value(dcfg_Instance *instance, AST *root) dcfg_Value *dcfg_parse(dcfg_Instance *instance, dcfg_StringView const file_path) { - char path_buf[file_path.size + 1]; - memset(path_buf, 0, sizeof(path_buf)); + char *path_buf = malloc(file_path.size + 1); + memset(path_buf, 0, file_path.size + 1); memcpy(path_buf, file_path.data, file_path.size); char *abs = instance->realpath(path_buf); + free(path_buf); if (!abs) { snprintf(instance->last_error, sizeof(instance->last_error) - 1, "realpath: %s", strerror(errno));