diff options
author | Gerald Combs <gerald@wireshark.org> | 2017-10-11 22:19:56 +0000 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2017-10-13 06:10:27 +0000 |
commit | 32d31e55ae7ed3b2b3e184e64fa82f1cda5604c4 (patch) | |
tree | f4b06b61432c975e206cae4fb84700d6fb32ef6c /plugins/wimaxasncp/wimaxasncp_dict.l | |
parent | f3ba040479f35e8b6f630553159b1b799fbae665 (diff) |
WiMAX ASN CP: Leak less memory.
Replace some g_new()s, g_strdup()s and GArrays used in prefix
registration with their epan_scoped wmem equivalents. This reduces
the amount of memory we leak so that we come in below the Valgrind
fuzzer's current threshold (102400).
Bug: 14106
Change-Id: I7308ac89465316c06773552253dabc876b6c2425
Reviewed-on: https://code.wireshark.org/review/23891
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'plugins/wimaxasncp/wimaxasncp_dict.l')
-rw-r--r-- | plugins/wimaxasncp/wimaxasncp_dict.l | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/plugins/wimaxasncp/wimaxasncp_dict.l b/plugins/wimaxasncp/wimaxasncp_dict.l index 7283b0ec43..d5ca35f5a1 100644 --- a/plugins/wimaxasncp/wimaxasncp_dict.l +++ b/plugins/wimaxasncp/wimaxasncp_dict.l @@ -370,7 +370,7 @@ since_attr since=\042 <GET_ATTR>{ndquot} { - *yyextra->attr_str = g_strdup(yytext); + *yyextra->attr_str = wmem_strdup(wmem_epan_scope(), yytext); D(("%s\n",yytext)); yyextra->attr_str = NULL; BEGIN END_ATTR; @@ -444,12 +444,7 @@ since_attr since=\042 <IN_DICT>{tlv_start} { D(("tlv_start\n")); - yyextra->tlv = g_new(wimaxasncp_dict_tlv_t,1); - yyextra->tlv->type = 0; - yyextra->tlv->name = NULL; - yyextra->tlv->description = NULL; - yyextra->tlv->decoder = 0; - yyextra->tlv->since = 0; + yyextra->tlv = wmem_new0(wmem_epan_scope(), wimaxasncp_dict_tlv_t); yyextra->tlv->hf_root = -1; yyextra->tlv->hf_value = -1; yyextra->tlv->hf_ipv4 = -1; @@ -462,9 +457,6 @@ since_attr since=\042 yyextra->tlv->hf_ipv6_mask = -1; yyextra->tlv->hf_vendor_id = -1; yyextra->tlv->hf_vendor_rest_of_info = -1; - yyextra->tlv->enum_vs = NULL; - yyextra->tlv->enums = NULL; - yyextra->tlv->next = NULL; if (! yyextra->dict->tlvs ) yyextra->last_tlv = yyextra->dict->tlvs = yyextra->tlv; @@ -486,7 +478,7 @@ since_attr since=\042 <IN_TLV>{enum_start} { D(("enum_start\n")); - yyextra->enumitem = g_new(wimaxasncp_dict_enum_t,1); + yyextra->enumitem = wmem_new(wmem_epan_scope(), wimaxasncp_dict_enum_t); yyextra->enumitem->name = NULL; yyextra->enumitem->code = 0; yyextra->enumitem->next = NULL; |