aboutsummaryrefslogtreecommitdiffstats
path: root/packet-smb-common.c
diff options
context:
space:
mode:
authortpot <tpot@f5534014-38df-0310-8fa8-9805f1628bb7>2003-04-03 02:22:30 +0000
committertpot <tpot@f5534014-38df-0310-8fa8-9805f1628bb7>2003-04-03 02:22:30 +0000
commit317683cf5362508f5ed395828445bda9ebd24043 (patch)
tree0051fcb6f8bc4e3b4c2e832a3d9f3ec446f089d0 /packet-smb-common.c
parente6f5890347bbe23c638ac60862a3db49a8a573bd (diff)
Add an extra argument to get_ms_string() so we can optionally pass
back the value of the string to the caller. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@7398 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'packet-smb-common.c')
-rw-r--r--packet-smb-common.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/packet-smb-common.c b/packet-smb-common.c
index 52ea9f9c82..6e1be15cc1 100644
--- a/packet-smb-common.c
+++ b/packet-smb-common.c
@@ -2,7 +2,7 @@
* Common routines for smb packet dissection
* Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com>
*
- * $Id: packet-smb-common.c,v 1.14 2002/08/28 21:00:31 jmayer Exp $
+ * $Id: packet-smb-common.c,v 1.15 2003/04/03 02:22:30 tpot Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -49,7 +49,7 @@ const value_string share_type_vals[] = {
{0, NULL}
};
-int display_ms_string(tvbuff_t *tvb, proto_tree *tree, int offset, int hf_index)
+int display_ms_string(tvbuff_t *tvb, proto_tree *tree, int offset, int hf_index, char **data)
{
char *str;
int len;
@@ -69,13 +69,12 @@ int display_ms_string(tvbuff_t *tvb, proto_tree *tree, int offset, int hf_index)
proto_tree_add_string(tree, hf_index, tvb, offset, len+1, str);
- /*
- * XXX - "proto_tree_add_string()" mallocates a copy; it'd
- * be nice not to have it copy the string, but just to
- * make it the value, avoiding both the copy and the free
- * on the next line.
- */
- g_free(str);
+ /* Return a copy of the string if requested */
+
+ if (data)
+ *data = str;
+ else
+ g_free(str);
return offset+len+1;
}