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));