summaryrefslogtreecommitdiff
path: root/epan/wslua/wslua_proto_field.c
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2015-08-15 19:25:13 +0200
committerStig Bjørlykke <stig@bjorlykke.org>2015-08-15 17:26:54 +0000
commit5f13933ddb17b816e3aa418e741e33760333033c (patch)
treef8e84098020c19026793a907d067d10467e880e6 /epan/wslua/wslua_proto_field.c
parent0a16350b05f9a55e630655b024c730e54b10aeda (diff)
downloadwireshark-5f13933ddb17b816e3aa418e741e33760333033c.tar.gz
Lua: Free true_false_string values at reload
Change-Id: I8ab194bf094e82f08ddafb0a1451aec42989b93d Reviewed-on: https://code.wireshark.org/review/10044 Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Diffstat (limited to 'epan/wslua/wslua_proto_field.c')
-rw-r--r--epan/wslua/wslua_proto_field.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/epan/wslua/wslua_proto_field.c b/epan/wslua/wslua_proto_field.c
index d10089fd25..9895b2697b 100644
--- a/epan/wslua/wslua_proto_field.c
+++ b/epan/wslua/wslua_proto_field.c
@@ -226,7 +226,7 @@ static val64_string* val64_string_from_table(lua_State* L, int idx) {
static true_false_string* true_false_string_from_table(lua_State* L, int idx) {
GArray* tfs = g_array_new(TRUE,TRUE,sizeof(true_false_string));
true_false_string* ret;
- true_false_string tf = { "True", "False" };
+ true_false_string tf = { g_strdup("True"), g_strdup("False") };
if (lua_isnil(L,idx)) {
return NULL;
@@ -253,11 +253,15 @@ static true_false_string* true_false_string_from_table(lua_State* L, int idx) {
}
/* arrays in LUA start with index number 1 */
- if (lua_tointeger(L,-2) == 1)
+ if (lua_tointeger(L,-2) == 1) {
+ g_free((gchar *)tf.true_string);
tf.true_string = g_strdup(lua_tostring(L,-1));
+ }
- if (lua_tointeger(L,-2) == 2)
+ if (lua_tointeger(L,-2) == 2) {
+ g_free((gchar *)tf.false_string);
tf.false_string = g_strdup(lua_tostring(L,-1));
+ }
lua_pop(L, 1);
}