aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2018-03-06 23:26:10 +0100
committerAlexis La Goutte <alexis.lagoutte@gmail.com>2018-03-07 06:03:46 +0000
commit4945c50d3f8269c56d9d087d16d080144de146dc (patch)
tree007d56e86d9af7fbea1b45408f677a950a0c4493
parentcc764b92acc65f7727fc53180a09ba2088a8751b (diff)
SMB2: use file scope to avoid leaking memory
Bug: 14483 Change-Id: I1532fa57cd9a847c0408db95744eb7af3a6f4ee5 Reviewed-on: https://code.wireshark.org/review/26295 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: ronnie sahlberg <ronniesahlberg@gmail.com>
-rw-r--r--epan/dissectors/packet-smb2.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/epan/dissectors/packet-smb2.c b/epan/dissectors/packet-smb2.c
index bc8ed9fb72..10a420818f 100644
--- a/epan/dissectors/packet-smb2.c
+++ b/epan/dissectors/packet-smb2.c
@@ -3684,7 +3684,7 @@ dissect_smb2_find_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i
if (!pinfo->fd->flags.visited && si->saved && olb.len) {
si->saved->extra_info_type = SMB2_EI_FINDPATTERN;
- si->saved->extra_info = g_malloc(olb.len+1);
+ si->saved->extra_info = wmem_alloc(wmem_file_scope(), olb.len+1);
g_snprintf((char *)si->saved->extra_info,olb.len+1,"%s",buf);
}
@@ -4299,7 +4299,7 @@ dissect_smb2_find_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr
val_to_str(si->saved->infolevel, smb2_find_info_levels, "(Level:0x%02x)"),
(const char *)si->saved->extra_info);
- g_free(si->saved->extra_info);
+ wmem_free(wmem_file_scope(), si->saved->extra_info);
si->saved->extra_info_type = SMB2_EI_NONE;
si->saved->extra_info = NULL;
}
@@ -7973,13 +7973,13 @@ dissect_smb2_create_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* save the name if it looks sane */
if (!pinfo->fd->flags.visited) {
if (si->saved && si->saved->extra_info_type == SMB2_EI_FILENAME) {
- g_free(si->saved->extra_info);
+ wmem_free(wmem_file_scope(), si->saved->extra_info);
si->saved->extra_info = NULL;
si->saved->extra_info_type = SMB2_EI_NONE;
}
if (si->saved && f_olb.len < 256) {
si->saved->extra_info_type = SMB2_EI_FILENAME;
- si->saved->extra_info = (gchar *)g_malloc(f_olb.len+1);
+ si->saved->extra_info = (gchar *)wmem_alloc(wmem_file_scope(), f_olb.len+1);
g_snprintf((gchar *)si->saved->extra_info, f_olb.len+1, "%s", fname);
}
}
@@ -8084,7 +8084,7 @@ dissect_smb2_create_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
/* free si->saved->extra_info we don't need it any more */
if (si->saved && si->saved->extra_info_type == SMB2_EI_FILENAME) {
- g_free(si->saved->extra_info);
+ wmem_free(wmem_file_scope(), si->saved->extra_info);
si->saved->extra_info = NULL;
si->saved->extra_info_type = SMB2_EI_NONE;
}