aboutsummaryrefslogtreecommitdiffstats
path: root/ui/tap-tcp-stream.c
diff options
context:
space:
mode:
authorDario Lombardo <lomato@gmail.com>2018-03-17 19:33:11 +0100
committerAnders Broman <a.broman58@gmail.com>2018-03-17 21:24:33 +0000
commit296cd7c91d8975731a2f9b5e00cf5f8ed7659623 (patch)
tree4161c8625bb9d19f9aeac12d9555a40001818a10 /ui/tap-tcp-stream.c
parentc26f7daae33290949becbcbc52261c8a3a9da24d (diff)
tap-tcp-stream: replace some g_malloc with g_new.
Change-Id: I25414be8ea73b986ea84294686a1d97159e1e2c7 Reviewed-on: https://code.wireshark.org/review/26525 Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui/tap-tcp-stream.c')
-rw-r--r--ui/tap-tcp-stream.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ui/tap-tcp-stream.c b/ui/tap-tcp-stream.c
index eae8b40a6c..cd78dee397 100644
--- a/ui/tap-tcp-stream.c
+++ b/ui/tap-tcp-stream.c
@@ -61,7 +61,7 @@ tapall_tcpip_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_, cons
ts->direction)
&& tg->stream == tcphdr->th_stream)
{
- struct segment *segment = (struct segment *)g_malloc(sizeof(struct segment));
+ struct segment *segment = g_new(struct segment, 1);
segment->next = NULL;
segment->num = pinfo->num;
segment->rel_secs = (guint32)pinfo->rel_ts.secs;
@@ -253,7 +253,7 @@ tap_tcpip_packet(void *pct, packet_info *pinfo _U_, epan_dissect_t *edt _U_, con
if (is_unique && (th->num_hdrs < MAX_SUPPORTED_TCP_HEADERS)) {
/* Need to take a deep copy of the tap struct, it may not be valid
to read after this function returns? */
- th->tcphdrs[th->num_hdrs] = (struct tcpheader *)g_malloc(sizeof(struct tcpheader));
+ th->tcphdrs[th->num_hdrs] = g_new(struct tcpheader, 1);
*(th->tcphdrs[th->num_hdrs]) = *header;
copy_address(&th->tcphdrs[th->num_hdrs]->ip_src, &header->ip_src);
copy_address(&th->tcphdrs[th->num_hdrs]->ip_dst, &header->ip_dst);
@@ -370,7 +370,7 @@ rtt_get_new_unack(double time_val, unsigned int seqno, unsigned int seglen)
{
struct rtt_unack *u;
- u = (struct rtt_unack * )g_malloc(sizeof(struct rtt_unack));
+ u = g_new(struct rtt_unack, 1);
u->next = NULL;
u->time = time_val;
u->seqno = seqno;