[sr-dev] git:4.2:511c7fb6: app_lua: Fix memory leak in sr.modf

Hugh Waite hugh.waite at acision.com
Mon May 18 17:43:17 CEST 2015


Module: kamailio
Branch: 4.2
Commit: 511c7fb674928e6c2d67256714bd1b7394b0d550
URL: https://github.com/kamailio/kamailio/commit/511c7fb674928e6c2d67256714bd1b7394b0d550

Author: Hugh Waite <hugh.waite at acision.com>
Committer: Hugh Waite <hugh.waite at acision.com>
Date: 2015-05-18T16:42:40+01:00

app_lua: Fix memory leak in sr.modf

- Free pkg memory allocated to store cloned function parameters
(cherry picked from commit 733f5ad7c9b2515c52b00875fb5dac689ddd9a17)

---

Modified: modules/app_lua/app_lua_sr.c

---

Diff:  https://github.com/kamailio/kamailio/commit/511c7fb674928e6c2d67256714bd1b7394b0d550.diff
Patch: https://github.com/kamailio/kamailio/commit/511c7fb674928e6c2d67256714bd1b7394b0d550.patch

---

diff --git a/modules/app_lua/app_lua_sr.c b/modules/app_lua/app_lua_sr.c
index 0c100c9..b75b724 100644
--- a/modules/app_lua/app_lua_sr.c
+++ b/modules/app_lua/app_lua_sr.c
@@ -265,6 +265,11 @@ static int lua_sr_modf (lua_State *L)
 		}
 	}
 	pkg_free(act);
+	for(i=0; i<MAX_ACTIONS; i++)
+	{
+		if(argv[i]!=NULL) pkg_free(argv[i]);
+		argv[i] = 0;
+	}
 	lua_pushinteger(L, ret);
 	return 1;
 




More information about the sr-dev mailing list