Move ep_free_all() *AFTER* packet dissection.
Use glib allocator for data_source. Thread on wireshark-dev: http://www.wireshark.org/lists/wireshark-dev/201210/msg00116.html svn path=/trunk/; revision=45673
This commit is contained in:
parent
b53dbea042
commit
2fd81fdaf9
12
epan/epan.c
12
epan/epan.c
|
@ -192,22 +192,22 @@ void
|
|||
epan_dissect_run(epan_dissect_t *edt, struct wtap_pkthdr *phdr,
|
||||
const guint8* data, frame_data *fd, column_info *cinfo)
|
||||
{
|
||||
/* free all memory allocated during previous packet */
|
||||
ep_free_all();
|
||||
|
||||
dissect_packet(edt, phdr, data, fd, cinfo);
|
||||
|
||||
/* free all memory allocated */
|
||||
ep_free_all();
|
||||
}
|
||||
|
||||
void
|
||||
epan_dissect_run_with_taps(epan_dissect_t *edt, struct wtap_pkthdr *phdr,
|
||||
const guint8* data, frame_data *fd, column_info *cinfo)
|
||||
{
|
||||
/* free all memory allocated during previous packet */
|
||||
ep_free_all();
|
||||
|
||||
tap_queue_init(edt);
|
||||
dissect_packet(edt, phdr, data, fd, cinfo);
|
||||
tap_push_tapped_queue(edt);
|
||||
|
||||
/* free all memory allocated */
|
||||
ep_free_all();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -66,7 +66,7 @@ static dissector_handle_t data_handle = NULL;
|
|||
*/
|
||||
struct data_source {
|
||||
tvbuff_t *tvb;
|
||||
const char *name;
|
||||
char *name;
|
||||
};
|
||||
|
||||
void
|
||||
|
@ -229,9 +229,9 @@ add_new_data_source(packet_info *pinfo, tvbuff_t *tvb, const char *name)
|
|||
{
|
||||
struct data_source *src;
|
||||
|
||||
src = ep_alloc(sizeof (struct data_source));
|
||||
src = g_malloc(sizeof(struct data_source));
|
||||
src->tvb = tvb;
|
||||
src->name = name;
|
||||
src->name = g_strdup(name);
|
||||
pinfo->data_src = g_slist_append(pinfo->data_src, src);
|
||||
}
|
||||
|
||||
|
@ -254,6 +254,14 @@ void
|
|||
free_data_sources(packet_info *pinfo)
|
||||
{
|
||||
if (pinfo->data_src) {
|
||||
GSList *l;
|
||||
|
||||
for (l = pinfo->data_src; l; l = l->next) {
|
||||
struct data_source *src = l->data;
|
||||
|
||||
g_free(src->name);
|
||||
g_free(src);
|
||||
}
|
||||
g_slist_free(pinfo->data_src);
|
||||
pinfo->data_src = NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue