summaryrefslogtreecommitdiff
path: root/epan
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
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')
-rw-r--r--epan/proto.c7
-rw-r--r--epan/wslua/wslua_proto_field.c10
2 files changed, 12 insertions, 5 deletions
diff --git a/epan/proto.c b/epan/proto.c
index 66fb23b421..4b10b356e4 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -5733,9 +5733,12 @@ free_deregistered_field (gpointer data, gpointer user_data _U_)
g_free((gchar *)protocol->short_name);
break;
}
- case FT_BOOLEAN:
- /* Nothing to free */
+ case FT_BOOLEAN: {
+ true_false_string *tf = (true_false_string *)hfi->strings;
+ g_free ((gchar *)tf->true_string);
+ g_free ((gchar *)tf->false_string);
break;
+ }
case FT_UINT64:
case FT_INT64: {
val64_string *vs64 = (val64_string *)hfi->strings;
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);
}