Plug a memory leak on Lua rpm.expand()
authorPanu Matilainen <pmatilai@redhat.com>
Tue, 24 May 2011 16:59:36 +0000 (19:59 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Tue, 24 May 2011 17:00:51 +0000 (20:00 +0300)
rpmio/rpmlua.c

index a2f70bf..1f9254a 100644 (file)
@@ -604,7 +604,9 @@ static int rpm_b64decode(lua_State *L)
 static int rpm_expand(lua_State *L)
 {
     const char *str = luaL_checkstring(L, 1);
-    lua_pushstring(L, rpmExpand(str, NULL));
+    char *val = rpmExpand(str, NULL);
+    lua_pushstring(L, val);
+    free(val);
     return 1;
 }