diff options
author | Adam Harrison <adamdharrison@gmail.com> | 2023-05-22 13:47:55 -0400 |
---|---|---|
committer | Adam Harrison <adamdharrison@gmail.com> | 2023-05-22 13:47:55 -0400 |
commit | 9d2e02a6f7191036b3d6f1db8858ded619693b06 (patch) | |
tree | dbbf16874f318b37e630a1658ec29cfaf4914fb9 | |
parent | 828b9e8f96d0e14f1e39f09cce1def3fdf698e46 (diff) | |
download | lite-xl-plugin-manager-9d2e02a6f7191036b3d6f1db8858ded619693b06.tar.gz lite-xl-plugin-manager-9d2e02a6f7191036b3d6f1db8858ded619693b06.zip |
Fixed a no-free error memory leak.
-rw-r--r-- | src/lpm.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -242,7 +242,7 @@ static int lpm_stat(lua_State *L) { #else struct stat s; int err = lstat(path, &s); - const char *abs_path = realpath(path, NULL); + const char *abs_path = !err ? realpath(path, NULL) : NULL; #endif if (err || !abs_path) { lua_pushnil(L); @@ -251,6 +251,7 @@ static int lpm_stat(lua_State *L) { } lua_newtable(L); lua_pushstring(L, abs_path); lua_setfield(L, -2, "abs_path"); + free((char*)abs_path); lua_pushvalue(L, 1); lua_setfield(L, -2, "path"); #if __linux__ |