aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-dns.c
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2017-09-10 17:47:36 +0200
committerMichael Mann <mmann78@netscape.net>2017-09-10 18:11:12 +0000
commit85d742ef26970e35d16f16a9bea04a12ff618e17 (patch)
tree2dd2cecef5dc0678456c93861b1c5cd92ddea424 /epan/dissectors/packet-dns.c
parent4a2923d78b69e11e09c5cc3943f23cf40588dc37 (diff)
DNS: replace g_strsplit by wmem_strsplit
It avoids leaking memory in case an exception is thrown during dissection Change-Id: Iab72bcb4cc1ac56e7ce5ff2693e3111aead03e7d Reviewed-on: https://code.wireshark.org/review/23464 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-dns.c')
-rw-r--r--epan/dissectors/packet-dns.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/epan/dissectors/packet-dns.c b/epan/dissectors/packet-dns.c
index 20f93254a3..776a78ea38 100644
--- a/epan/dissectors/packet-dns.c
+++ b/epan/dissectors/packet-dns.c
@@ -1491,7 +1491,7 @@ add_rr_to_tree(proto_tree *rr_tree, tvbuff_t *tvb, int offset,
gchar **srv_rr_info;
if (type == T_SRV) {
- srv_rr_info = g_strsplit(name, ".", 3);
+ srv_rr_info = wmem_strsplit(wmem_packet_scope(), name, ".", 3);
/* The + 1 on the strings is to skip the leading '_' */
@@ -1507,8 +1507,6 @@ add_rr_to_tree(proto_tree *rr_tree, tvbuff_t *tvb, int offset,
namelen, srv_rr_info[2]);
}
}
-
- g_strfreev(srv_rr_info);
} else {
proto_tree_add_string(rr_tree, hf_dns_rr_name, tvb, offset, namelen, name);
}