diff options
author | Jeff Morriss <jeff.morriss@ulticom.com> | 2008-03-17 12:03:36 +0000 |
---|---|---|
committer | Jeff Morriss <jeff.morriss@ulticom.com> | 2008-03-17 12:03:36 +0000 |
commit | 19a95385be68534d92ee284d024b4868510d62cd (patch) | |
tree | 41284b050c556d804f9bf248620307b14a076a90 | |
parent | d69054190567b5be32aef0884533860d7b4953f5 (diff) |
There are several g_malloc()'d things hanging off ldasp_conv_info_t's so don't se_ alloc that structure but rather g_malloc() it and free it after we've freed the contents. This fixes the LDAP part of the crash from http://bugs.wireshark.org/bugzilla/show_bug.cgi?id=1113
svn path=/trunk/; revision=24664
-rw-r--r-- | asn1/ldap/packet-ldap-template.c | 10 | ||||
-rw-r--r-- | epan/dissectors/packet-ldap.c | 16 |
2 files changed, 19 insertions, 7 deletions
diff --git a/asn1/ldap/packet-ldap-template.c b/asn1/ldap/packet-ldap-template.c index 3bedd544f7..4dea39ba27 100644 --- a/asn1/ldap/packet-ldap-template.c +++ b/asn1/ldap/packet-ldap-template.c @@ -692,7 +692,7 @@ dissect_ldap_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean i /* No. Attach that information to the conversation, and add * it to the list of information structures. */ - ldap_info = se_alloc(sizeof(ldap_conv_info_t)); + ldap_info = g_malloc(sizeof(ldap_conv_info_t)); ldap_info->auth_type = 0; ldap_info->auth_mech = 0; ldap_info->first_auth_frame = 0; @@ -1477,7 +1477,9 @@ ldap_reinit(void) ldap_conv_info_t *ldap_info; /* Free up state attached to the ldap_info structures */ - for (ldap_info = ldap_info_items; ldap_info != NULL; ldap_info = ldap_info->next) { + for (ldap_info = ldap_info_items; ldap_info != NULL; ) { + ldap_conv_info_t *last; + if (ldap_info->auth_mech != NULL) { g_free(ldap_info->auth_mech); ldap_info->auth_mech=NULL; @@ -1486,6 +1488,10 @@ ldap_reinit(void) ldap_info->matched=NULL; g_hash_table_destroy(ldap_info->unmatched); ldap_info->unmatched=NULL; + + last = ldap_info; + ldap_info = ldap_info->next; + g_free(ldap_info); } ldap_info_items = NULL; diff --git a/epan/dissectors/packet-ldap.c b/epan/dissectors/packet-ldap.c index 79d9643e58..c59ee85b06 100644 --- a/epan/dissectors/packet-ldap.c +++ b/epan/dissectors/packet-ldap.c @@ -3238,7 +3238,7 @@ dissect_ldap_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean i /* No. Attach that information to the conversation, and add * it to the list of information structures. */ - ldap_info = se_alloc(sizeof(ldap_conv_info_t)); + ldap_info = g_malloc(sizeof(ldap_conv_info_t)); ldap_info->auth_type = 0; ldap_info->auth_mech = 0; ldap_info->first_auth_frame = 0; @@ -4023,7 +4023,9 @@ ldap_reinit(void) ldap_conv_info_t *ldap_info; /* Free up state attached to the ldap_info structures */ - for (ldap_info = ldap_info_items; ldap_info != NULL; ldap_info = ldap_info->next) { + for (ldap_info = ldap_info_items; ldap_info != NULL; ) { + ldap_conv_info_t *last; + if (ldap_info->auth_mech != NULL) { g_free(ldap_info->auth_mech); ldap_info->auth_mech=NULL; @@ -4032,6 +4034,10 @@ ldap_reinit(void) ldap_info->matched=NULL; g_hash_table_destroy(ldap_info->unmatched); ldap_info->unmatched=NULL; + + last = ldap_info; + ldap_info = ldap_info->next; + g_free(ldap_info); } ldap_info_items = NULL; @@ -4710,7 +4716,7 @@ void proto_register_ldap(void) { "ldap.MessageID", HFILL }}, /*--- End of included file: packet-ldap-hfarr.c ---*/ -#line 1683 "packet-ldap-template.c" +#line 1689 "packet-ldap-template.c" }; /* List of subtrees */ @@ -4771,7 +4777,7 @@ void proto_register_ldap(void) { &ett_ldap_CancelRequestValue, /*--- End of included file: packet-ldap-ettarr.c ---*/ -#line 1694 "packet-ldap-template.c" +#line 1700 "packet-ldap-template.c" }; module_t *ldap_module; @@ -4894,7 +4900,7 @@ proto_reg_handoff_ldap(void) /*--- End of included file: packet-ldap-dis-tab.c ---*/ -#line 1805 "packet-ldap-template.c" +#line 1811 "packet-ldap-template.c" } |