diff options
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-smb-common.c | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-smb-common.h | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-smb-logon.c | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/epan/dissectors/packet-smb-common.c b/epan/dissectors/packet-smb-common.c index 8042b01b11..bad99e3807 100644 --- a/epan/dissectors/packet-smb-common.c +++ b/epan/dissectors/packet-smb-common.c @@ -101,7 +101,7 @@ int display_unicode_string(tvbuff_t *tvb, proto_tree *tree, int offset, int hf_i * Allocate a buffer for the string; "len" is the length in * bytes, not the length in characters. */ - str = g_malloc(len/2); + str = ep_alloc(len/2); /* * XXX - this assumes the string is just ISO 8859-1; we need @@ -121,8 +121,6 @@ int display_unicode_string(tvbuff_t *tvb, proto_tree *tree, int offset, int hf_i if (data) *data = str; - else - g_free(str); return offset+len; } diff --git a/epan/dissectors/packet-smb-common.h b/epan/dissectors/packet-smb-common.h index 915fe193b0..d31d80ae4b 100644 --- a/epan/dissectors/packet-smb-common.h +++ b/epan/dissectors/packet-smb-common.h @@ -28,6 +28,10 @@ #ifndef __PACKET_SMB_COMMON_H__ #define __PACKET_SMB_COMMON_H__ +/* **data is allocated with ephemeral scope and will be automatically freed + * when packet dissection completes. + * You do NOT need to g_free() that string. + */ int display_unicode_string(tvbuff_t *tvb, proto_tree *tree, int offset, int hf_index, char **data); int display_ms_string(tvbuff_t *tvb, proto_tree *tree, int offset, int hf_index, char **data); diff --git a/epan/dissectors/packet-smb-logon.c b/epan/dissectors/packet-smb-logon.c index cbb54cb572..e3094ffe8a 100644 --- a/epan/dissectors/packet-smb-logon.c +++ b/epan/dissectors/packet-smb-logon.c @@ -381,7 +381,6 @@ dissect_smb_pdc_startup(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, if (name && check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, ": host %s", name); - g_free(name); name = NULL; } @@ -392,7 +391,6 @@ dissect_smb_pdc_startup(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, if (name && check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, ", domain %s", name); - g_free(name); name = NULL; } |