Blame SOURCES/wireshark-1.10.x-remove-last-data-source.patch

6415a4
diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c
6415a4
index e9af5f8..d994233 100644
6415a4
--- a/epan/dissectors/packet-tcp.c
6415a4
+++ b/epan/dissectors/packet-tcp.c
dbc6ab
@@ -1924,6 +1924,7 @@ again:
6415a4
                  * being a new higher-level PDU that also
6415a4
                  * needs desegmentation).
6415a4
                  */
6415a4
+                remove_last_data_source(pinfo);
6415a4
                 fragment_set_partial_reassembly(&tcp_reassembly_table,
6415a4
                                                 pinfo, msp->first_frame, NULL);
6415a4
 
6415a4
diff --git a/epan/packet.c b/epan/packet.c
6415a4
index 44b953f..509fb22 100644
6415a4
--- a/epan/packet.c
6415a4
+++ b/epan/packet.c
6415a4
@@ -237,9 +237,24 @@ add_new_data_source(packet_info *pinfo, tvbuff_t *tvb, const char *name)
6415a4
 	src = (struct data_source *)g_malloc(sizeof(struct data_source));
6415a4
 	src->tvb = tvb;
6415a4
 	src->name = g_strdup(name);
6415a4
+	/* This could end up slow, but we should never have that many data
6415a4
+	 * sources so it probably doesn't matter */
6415a4
 	pinfo->data_src = g_slist_append(pinfo->data_src, src);
6415a4
 }
6415a4
 
6415a4
+void
6415a4
+remove_last_data_source(packet_info *pinfo)
6415a4
+{
6415a4
+	struct data_source *src;
6415a4
+	GSList *last;
6415a4
+
6415a4
+	last = g_slist_last(pinfo->data_src);
6415a4
+	src = (struct data_source *)last->data;
6415a4
+	pinfo->data_src = g_slist_delete_link(pinfo->data_src, last);
6415a4
+	g_free(src->name);
6415a4
+	g_slice_free(struct data_source, src);
6415a4
+}
6415a4
+
6415a4
 const char*
6415a4
 get_data_source_name(const struct data_source *src)
6415a4
 {
6415a4
diff --git a/epan/packet.h b/epan/packet.h
6415a4
index e1a195b..f90199d 100644
6415a4
--- a/epan/packet.h
6415a4
+++ b/epan/packet.h
6415a4
@@ -408,6 +408,8 @@ final_registration_all_protocols(void);
6415a4
  */
6415a4
 WS_DLL_PUBLIC void add_new_data_source(packet_info *pinfo, tvbuff_t *tvb,
6415a4
     const char *name);
6415a4
+/* Removes the last-added data source, if it turns out it wasn't needed */
6415a4
+WS_DLL_PUBLIC void remove_last_data_source(packet_info *pinfo);
6415a4
 
6415a4
 
6415a4
 /*