aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>2004-11-23 22:02:00 +0000
committeretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>2004-11-23 22:02:00 +0000
commit3897525f3821e006da0d2c2adfbe8819d8cab089 (patch)
tree16db039ad7f84cf65c9db920a7928723fc6a6c59
parenta22c74cb3783ec2964552fd30568110a116e176a (diff)
Don't free string that don't need it. Added filter possibillity on Partial state
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@12582 f5534014-38df-0310-8fa8-9805f1628bb7
-rw-r--r--epan/sigcomp-udvm.c13
-rw-r--r--epan/sigcomp-udvm.h2
-rw-r--r--epan/sigcomp_state_hdlr.c12
-rw-r--r--epan/sigcomp_state_hdlr.h2
4 files changed, 13 insertions, 16 deletions
diff --git a/epan/sigcomp-udvm.c b/epan/sigcomp-udvm.c
index 06714a3061..17c023177b 100644
--- a/epan/sigcomp-udvm.c
+++ b/epan/sigcomp-udvm.c
@@ -125,7 +125,7 @@ static int decomp_dispatch_get_bits(tvbuff_t *message_tvb,proto_tree *udvm_tree,
tvbuff_t*
decompress_sigcomp_message(tvbuff_t *bytecode_tvb, tvbuff_t *message_tvb, packet_info *pinfo,
- proto_tree *udvm_tree, gint udvm_mem_dest, gint print_flags)
+ proto_tree *udvm_tree, gint udvm_mem_dest, gint print_flags, gint hf_id)
{
tvbuff_t *decomp_tvb;
guint8 buff[UDVM_MEMORY_SIZE];
@@ -1940,7 +1940,7 @@ execute_next_instruction:
}
result_code = udvm_state_access(message_tvb, udvm_tree, buff, p_id_start, p_id_length, state_begin, &state_length,
- &state_address, state_instruction, TRUE);
+ &state_address, state_instruction, TRUE, hf_id);
if ( result_code != 0 ){
goto decompression_failure;
}
@@ -2311,12 +2311,13 @@ execute_next_instruction:
sha1_update( &ctx, (guint8 *) sha1buff, state_length_buff[n] + 8);
sha1_finish( &ctx, sha1_digest_buf );
if (print_level_3 ){
- for( x=0; x < 20; x++){
- proto_tree_add_text(udvm_tree, bytecode_tvb, 0, -1,"SHA1 digest byte %u 0x%x",
- x,sha1_digest_buf[x]);
- }
+ proto_tree_add_text(udvm_tree, bytecode_tvb, 0, -1,"SHA1 digest %s",bytes_to_str(sha1_digest_buf, 20));
+
}
udvm_state_create(sha1buff, sha1_digest_buf, state_minimum_access_length_buff[n]);
+ proto_tree_add_text(udvm_tree,bytecode_tvb, 0, -1,"### Creating state ###");
+ proto_tree_add_string(udvm_tree,hf_id, bytecode_tvb, 0, 0, bytes_to_str(sha1_digest_buf, state_minimum_access_length_buff[n]));
+
n++;
}
diff --git a/epan/sigcomp-udvm.h b/epan/sigcomp-udvm.h
index 5f108d554f..387e3c1e6b 100644
--- a/epan/sigcomp-udvm.h
+++ b/epan/sigcomp-udvm.h
@@ -36,7 +36,7 @@
#define UDVM_MEMORY_SIZE 65536
extern tvbuff_t* decompress_sigcomp_message(tvbuff_t *bytecode_tvb, tvbuff_t *message_tvb, packet_info *pinfo,
- proto_tree *tree, gint destination, gint print_flags);
+ proto_tree *tree, gint destination, gint print_flags, gint hf_id);
diff --git a/epan/sigcomp_state_hdlr.c b/epan/sigcomp_state_hdlr.c
index f50f863b8b..569088f38a 100644
--- a/epan/sigcomp_state_hdlr.c
+++ b/epan/sigcomp_state_hdlr.c
@@ -428,13 +428,12 @@ sigcomp_init_udvm(void){
* g_warning("g_hash_table_insert = 0x%x",sip_sdp_buff);
* g_warning("g_hash_table_insert = 0x%x",sip_sdp_buff);
*/
- g_free(partial_state_str);
}
int udvm_state_access(tvbuff_t *tvb, proto_tree *tree,guint8 *buff,guint16 p_id_start, guint16 p_id_length, guint16 state_begin, guint16 *state_length,
- guint16 *state_address, guint16 state_instruction, gboolean state_vars_valid)
+ guint16 *state_address, guint16 state_instruction, gboolean state_vars_valid, gint hf_id)
{
int result_code = 0;
guint16 n;
@@ -470,7 +469,9 @@ int udvm_state_access(tvbuff_t *tvb, proto_tree *tree,guint8 *buff,guint16 p_id_
n++;
}
partial_state_str = bytes_to_str(partial_state, p_id_length);
- proto_tree_add_text(tree,tvb, 0, -1,"Accessing state: %s",partial_state_str);
+ proto_tree_add_text(tree,tvb, 0, -1,"### Accessing state ###");
+ proto_tree_add_string(tree,hf_id, tvb, 0, 0, partial_state_str);
+
/* Debug
* g_warning("State Access: partial state =%s",partial_state_str);
* g_warning("g_hash_table_lookup = 0x%x",state_buff);
@@ -479,7 +480,6 @@ int udvm_state_access(tvbuff_t *tvb, proto_tree *tree,guint8 *buff,guint16 p_id_
state_buff = g_hash_table_lookup(state_buffer_table, partial_state_str);
if ( state_buff == NULL ){
result_code = 2; /* No state match */
- g_free(partial_state_str);
return result_code;
}
/*
@@ -601,7 +601,6 @@ int udvm_state_access(tvbuff_t *tvb, proto_tree *tree,guint8 *buff,guint16 p_id_
/* partial_state_ID_length */
buff[6] = p_id_length >> 8;
buff[7] = p_id_length & 0xff;
- g_free(partial_state_str);
return 0;
/*
* End SIP
@@ -637,8 +636,6 @@ void udvm_state_create(guint8 *state_buff,guint8 *state_identifier,guint16 p_id_
g_free(state_buff);
}
- g_free(partial_state_str);
-
}
void udvm_state_free(guint8 buff[],guint16 p_id_start,guint16 p_id_length){
@@ -656,7 +653,6 @@ void udvm_state_free(guint8 buff[],guint16 p_id_start,guint16 p_id_length){
i++;
}
partial_state_str = bytes_to_str(partial_state, p_id_length);
- g_free(partial_state_str);
/* TODO Implement a state create counter before actually freeing states
* Hmm is it a good idea to free the buffer at all?
g_warning("State-free on %s ",partial_state_str);
diff --git a/epan/sigcomp_state_hdlr.h b/epan/sigcomp_state_hdlr.h
index 732b6f2fb4..f33e9a1483 100644
--- a/epan/sigcomp_state_hdlr.h
+++ b/epan/sigcomp_state_hdlr.h
@@ -35,7 +35,7 @@
extern const value_string result_code_vals[];
extern int udvm_state_access(tvbuff_t *tvb, proto_tree *tree,guint8 *buff,guint16 p_id_start, guint16 p_id_length, guint16 state_begin, guint16 *state_length,
- guint16 *state_address, guint16 state_instruction, gboolean state_vars_valid);
+ guint16 *state_address, guint16 state_instruction, gboolean state_vars_valid, gint hf_id);
extern void udvm_state_create(guint8 *state_buff,guint8 *state_identifier_buff,guint16 p_id_length);
extern void udvm_state_free(guint8 buff[],guint16 p_id_start,guint16 p_id_length);