aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2005-08-19 08:12:26 +0000
committerRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2005-08-19 08:12:26 +0000
commit645863b8936d573f7a11febcd259ce02733f8bc1 (patch)
tree983ee25a33b4051a09c784c1c0a66e182fd07206 /epan
parent1f7b1af63f346a69ef49d2e3826af3ce2a082790 (diff)
remove g_malloc() from packet-smb-common
svn path=/trunk/; revision=15420
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-smb-common.c4
-rw-r--r--epan/dissectors/packet-smb-common.h4
-rw-r--r--epan/dissectors/packet-smb-logon.c2
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;
}