aboutsummaryrefslogtreecommitdiff
path: root/src/pkg_install.c
diff options
context:
space:
mode:
authordacctal <donotcontactmevia@email.invalid>2026-07-18 21:38:54 +0000
committerdacctal <donotcontactmevia@email.invalid>2026-07-18 21:38:54 +0000
commit7de8a098d40c1cc66ce116d4b913529337d3b8ed (patch)
tree5a909b081872c07cae17f640a61a2127d754e4e6 /src/pkg_install.c
parent45b6947f49e47a5aff2e2a93a1cca2bc913d869c (diff)
fix pkg install free pkg.version before overwriting in install_dependencies
Diffstat (limited to 'src/pkg_install.c')
-rw-r--r--src/pkg_install.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/pkg_install.c b/src/pkg_install.c
index 463bf92..10dd52f 100644
--- a/src/pkg_install.c
+++ b/src/pkg_install.c
@@ -42,7 +42,9 @@ void install_dependencies(lua_State *L) {
package_t pkg = pkg_create(&dep_url);
str_free(&dep_url);
lua_getfield(L, -1, "version");
- pkg.version = mstr(lua_tostring(L, -1));
+ str_free(&pkg.version);
+ const char *ver = lua_tostring(L, -1);
+ pkg.version = ver ? mstr(ver) : mstr("HEAD");
lua_pop(L, 1);
const int top = lua_gettop(L);
char cwd[MAX_PATH_LEN];