ememify some more calls to tvb_get_string()

this fixes an obvious memleak in ms-mms


svn path=/trunk/; revision=15132
This commit is contained in:
Ronnie Sahlberg 2005-07-28 09:56:19 +00:00
parent 0d7a2abbc7
commit df2d1d3f22
4 changed files with 4 additions and 8 deletions

View File

@ -1082,7 +1082,7 @@ void cb_str_postprocess(packet_info *pinfo, proto_tree *tree _U_,
* some way we can get that string, rather than duplicating the * some way we can get that string, rather than duplicating the
* efforts of that routine? * efforts of that routine?
*/ */
s = tvb_get_string( s = ep_tvb_get_string(
tvb, start_offset + 12, (end_offset - start_offset - 12) ); tvb, start_offset + 12, (end_offset - start_offset - 12) );
/* Append string to COL_INFO */ /* Append string to COL_INFO */
@ -1118,8 +1118,6 @@ void cb_str_postprocess(packet_info *pinfo, proto_tree *tree _U_,
dcv->private_data = g_strdup(s); dcv->private_data = g_strdup(s);
} }
g_free(s);
} }
/* Dissect a pointer to a NDR string and append the string value to the /* Dissect a pointer to a NDR string and append the string value to the

View File

@ -1328,7 +1328,7 @@ add_tagged_field (packet_info * pinfo, proto_tree * tree, tvbuff_t * tvb, int of
{ {
char *ssid; char *ssid;
ssid = tvb_get_string(tvb, offset + 2, tag_len); ssid = ep_tvb_get_string(tvb, offset + 2, tag_len);
proto_tree_add_string (tree, tag_interpretation, tvb, offset + 2, proto_tree_add_string (tree, tag_interpretation, tvb, offset + 2,
tag_len, ssid); tag_len, ssid);
if (check_col (pinfo->cinfo, COL_INFO)) { if (check_col (pinfo->cinfo, COL_INFO)) {
@ -1345,7 +1345,6 @@ add_tagged_field (packet_info * pinfo, proto_tree * tree, tvbuff_t * tvb, int of
} else { } else {
proto_item_append_text(ti, ": Broadcast"); proto_item_append_text(ti, ": Broadcast");
} }
g_free(ssid);
beacon_padding++; /* padding bug */ beacon_padding++; /* padding bug */
} }
break; break;

View File

@ -399,7 +399,7 @@ static gint dissect_msmms_command(tvbuff_t *tvb, packet_info *pinfo, proto_tree
offset += 4; offset += 4;
/* Protocol name. Must be "MMS"... */ /* Protocol name. Must be "MMS"... */
if (strncmp(tvb_get_string(tvb, offset, 3), "MMS", 3) != 0) if (strncmp(ep_tvb_get_string(tvb, offset, 3), "MMS", 3) != 0)
{ {
return 0; return 0;
} }

View File

@ -559,11 +559,10 @@ process_body_part(proto_tree *tree, tvbuff_t *tvb, const guint8 *boundary,
while (line_len > 0) while (line_len > 0)
{ {
gint colon_offset; gint colon_offset;
char *hdr_str = tvb_get_string(tvb, offset, next_offset - offset); char *hdr_str = ep_tvb_get_string(tvb, offset, next_offset - offset);
char *header_str; char *header_str;
header_str = unfold_and_compact_mime_header(hdr_str, &colon_offset); header_str = unfold_and_compact_mime_header(hdr_str, &colon_offset);
g_free(hdr_str);
if (colon_offset <= 0) { if (colon_offset <= 0) {
if (tree) { if (tree) {
proto_tree_add_text(subtree, tvb, offset, next_offset - offset, proto_tree_add_text(subtree, tvb, offset, next_offset - offset,