aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2021-10-19 20:17:52 +0200
committerWireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>2021-10-19 20:50:45 +0000
commitcfe33625a07472189a5b17190ca348108c8911cf (patch)
tree9fac8206c9754e2172461b382407e21381efcd9a
parent763247c2b39c880e1433abe0c55cdcb5ba6222ae (diff)
wslua: Initialize Proto members on creation
Set all pointers in Proto to NULL and check for valid pointers when wslua_deregister_protocols(). Fixes #17668
-rw-r--r--epan/wslua/wslua_proto.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/epan/wslua/wslua_proto.c b/epan/wslua/wslua_proto.c
index 1e9ee99784..af0881ceda 100644
--- a/epan/wslua/wslua_proto.c
+++ b/epan/wslua/wslua_proto.c
@@ -109,7 +109,7 @@ WSLUA_CONSTRUCTOR Proto_new(lua_State* L) { /* Creates a new <<lua_class_Proto,`
return 0;
}
- proto = g_new(wslua_proto_t, 1);
+ proto = g_new0(wslua_proto_t, 1);
proto->name = hiname;
proto->loname = loname;
@@ -652,7 +652,7 @@ int wslua_deregister_protocols(lua_State* L) {
}
lua_pop(L, 1);
- if (proto->hfa->len) {
+ if (proto->hfa && proto->hfa->len) {
proto_add_deregistered_data(g_array_free(proto->hfa,FALSE));
} else {
g_array_free(proto->hfa,TRUE);
@@ -661,7 +661,7 @@ int wslua_deregister_protocols(lua_State* L) {
/* No need for deferred deletion of subtree indexes */
g_array_free(proto->etta,TRUE);
- if (proto->eia->len) {
+ if (proto->eia && proto->eia->len) {
proto_add_deregistered_data(g_array_free(proto->eia,FALSE));
} else {
g_array_free(proto->eia,TRUE);