diff options
Diffstat (limited to 'ui')
-rw-r--r-- | ui/capture.c | 4 | ||||
-rw-r--r-- | ui/cli/tap-iostat.c | 12 | ||||
-rw-r--r-- | ui/cli/tap-sctpchunkstat.c | 2 | ||||
-rw-r--r-- | ui/filter_files.c | 2 | ||||
-rw-r--r-- | ui/iface_lists.c | 4 | ||||
-rw-r--r-- | ui/mcast_stream.c | 10 | ||||
-rw-r--r-- | ui/preference_utils.c | 2 | ||||
-rw-r--r-- | ui/profile.c | 2 | ||||
-rw-r--r-- | ui/recent.c | 8 | ||||
-rw-r--r-- | ui/tap-rlc-graph.c | 2 | ||||
-rw-r--r-- | ui/tap-rtp-common.c | 4 | ||||
-rw-r--r-- | ui/voip_calls.c | 36 |
12 files changed, 44 insertions, 44 deletions
diff --git a/ui/capture.c b/ui/capture.c index 22ebc96984..a90d77136b 100644 --- a/ui/capture.c +++ b/ui/capture.c @@ -84,7 +84,7 @@ capture_callback_add(capture_callback_t func, gpointer user_data) { capture_callback_data_t *cb; - cb = (capture_callback_data_t *)g_malloc(sizeof(capture_callback_data_t)); + cb = g_new(capture_callback_data_t, 1); cb->cb_fct = func; cb->user_data = user_data; @@ -860,7 +860,7 @@ capture_stat_start(capture_options *capture_opts) for (i = 0; i < capture_opts->all_ifaces->len; i++) { device = &g_array_index(capture_opts->all_ifaces, interface_t, i); if (device->type != IF_PIPE) { - sc_item = (if_stat_cache_item_t *)g_malloc0(sizeof(if_stat_cache_item_t)); + sc_item = g_new0(if_stat_cache_item_t, 1); g_assert(device->if_info.name); sc_item->name = g_strdup(device->if_info.name); sc->cache_list = g_list_prepend(sc->cache_list, sc_item); diff --git a/ui/cli/tap-iostat.c b/ui/cli/tap-iostat.c index 11794a2f1d..6640a59a09 100644 --- a/ui/cli/tap-iostat.c +++ b/ui/cli/tap-iostat.c @@ -115,7 +115,7 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du * struct will be created for it. */ rt = relative_time; while (rt >= it->start_time + parent->interval) { - it->next = (io_stat_item_t *)g_malloc(sizeof(io_stat_item_t)); + it->next = g_new(io_stat_item_t, 1); it->next->prev = it; it->next->next = NULL; it = it->next; @@ -572,7 +572,7 @@ iostat_draw(void *arg) mit = (io_stat_item_t *)arg; iot = mit->parent; num_cols = iot->num_cols; - col_w = (column_width *)g_malloc(sizeof(column_width) * num_cols); + col_w = g_new(column_width, num_cols); fmts = (char **)g_malloc(sizeof(char *) * num_cols); duration = ((guint64)cfile.elapsed_time.secs * G_GUINT64_CONSTANT(1000000)) + (guint64)((cfile.elapsed_time.nsecs + 500) / 1000); @@ -1423,7 +1423,7 @@ iostat_init(const char *opt_arg, void *userdata _U_) break; } - io = (io_stat_t *)g_malloc(sizeof(io_stat_t)); + io = g_new(io_stat_t, 1); /* If interval is 0, calculate statistics over the whole file by setting the interval to * G_MAXUINT64 */ @@ -1484,10 +1484,10 @@ iostat_init(const char *opt_arg, void *userdata _U_) } } - io->items = (io_stat_item_t *)g_malloc(sizeof(io_stat_item_t) * io->num_cols); + io->items = g_new(io_stat_item_t, io->num_cols); io->filters = (const char **)g_malloc(sizeof(char *) * io->num_cols); - io->max_vals = (guint64 *)g_malloc(sizeof(guint64) * io->num_cols); - io->max_frame = (guint32 *)g_malloc(sizeof(guint32) * io->num_cols); + io->max_vals = g_new(guint64, io->num_cols); + io->max_frame = g_new(guint32, io->num_cols); for (i=0; i<io->num_cols; i++) { io->max_vals[i] = 0; diff --git a/ui/cli/tap-sctpchunkstat.c b/ui/cli/tap-sctpchunkstat.c index 303aa6729d..00949129bc 100644 --- a/ui/cli/tap-sctpchunkstat.c +++ b/ui/cli/tap-sctpchunkstat.c @@ -190,7 +190,7 @@ sctpstat_init(const char *opt_arg, void *userdata _U_) sctpstat_t *hs; GString *error_string; - hs = (sctpstat_t *)g_malloc(sizeof(sctpstat_t)); + hs = g_new(sctpstat_t, 1); if (!strncmp(opt_arg, "sctp,stat,", 11)) { hs->filter = g_strdup(opt_arg+11); } else { diff --git a/ui/filter_files.c b/ui/filter_files.c index b289175a4e..299d84dd34 100644 --- a/ui/filter_files.c +++ b/ui/filter_files.c @@ -45,7 +45,7 @@ add_filter_entry(GList *fl, const char *filt_name, const char *filt_expr) { filter_def *filt; - filt = (filter_def *) g_malloc(sizeof(filter_def)); + filt = g_new(filter_def, 1); filt->name = g_strdup(filt_name); filt->strval = g_strdup(filt_expr); return g_list_prepend(fl, filt); diff --git a/ui/iface_lists.c b/ui/iface_lists.c index 135a83d4b3..9ba39b9c5e 100644 --- a/ui/iface_lists.c +++ b/ui/iface_lists.c @@ -227,7 +227,7 @@ scan_local_interfaces(void (*update_cb)(void)) monitor_mode = prefs_capture_device_monitor_mode(if_info->name); caps = capture_get_if_capabilities(if_info->name, monitor_mode, NULL, NULL, update_cb); for (; (curr_addr = g_slist_nth(if_info->addrs, ips)) != NULL; ips++) { - temp_addr = (if_addr_t *)g_malloc0(sizeof(if_addr_t)); + temp_addr = g_new0(if_addr_t, 1); if (ips != 0) { g_string_append(ip_str, "\n"); } @@ -290,7 +290,7 @@ scan_local_interfaces(void (*update_cb)(void)) */ for (lt_entry = caps->data_link_types; lt_entry != NULL; lt_entry = g_list_next(lt_entry)) { data_link_info = (data_link_info_t *)lt_entry->data; - link = (link_row *)g_malloc(sizeof(link_row)); + link = g_new(link_row, 1); if (data_link_info->description != NULL) { link->dlt = data_link_info->dlt; link->name = g_strdup(data_link_info->description); diff --git a/ui/mcast_stream.c b/ui/mcast_stream.c index 4824f9e672..74a704b630 100644 --- a/ui/mcast_stream.c +++ b/ui/mcast_stream.c @@ -196,7 +196,7 @@ mcaststream_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, const tmp_strinfo.total_bytes = 0; /* reset slidingwindow and buffer parameters */ - tmp_strinfo.element.buff = (nstime_t *)g_malloc(buffsize * sizeof(nstime_t)); + tmp_strinfo.element.buff = g_new(nstime_t, buffsize); tmp_strinfo.element.first=0; tmp_strinfo.element.last=0; tmp_strinfo.element.burstsize=1; @@ -210,16 +210,16 @@ mcaststream_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, const tmp_strinfo.element.buffstatus=0; tmp_strinfo.element.maxbw=0; - strinfo = (mcast_stream_info_t *)g_malloc(sizeof(mcast_stream_info_t)); + strinfo = g_new(mcast_stream_info_t, 1); *strinfo = tmp_strinfo; /* memberwise copy of struct */ tapinfo->strinfo_list = g_list_append(tapinfo->strinfo_list, strinfo); - strinfo->element.buff = (nstime_t *)g_malloc(buffsize * sizeof(nstime_t)); + strinfo->element.buff = g_new(nstime_t, buffsize); /* set time with the first packet */ if (tapinfo->npackets == 0) { - tapinfo->allstreams = (mcast_stream_info_t *)g_malloc(sizeof(mcast_stream_info_t)); + tapinfo->allstreams = g_new(mcast_stream_info_t, 1); tapinfo->allstreams->element.buff = - (nstime_t *)g_malloc(buffsize * sizeof(nstime_t)); + g_new(nstime_t, buffsize); tapinfo->allstreams->start_rel = pinfo->rel_ts; tapinfo->allstreams->total_bytes = 0; tapinfo->allstreams->element.first=0; diff --git a/ui/preference_utils.c b/ui/preference_utils.c index ef6ca14778..86fafc6452 100644 --- a/ui/preference_utils.c +++ b/ui/preference_utils.c @@ -164,7 +164,7 @@ column_prefs_add_custom(gint fmt, const gchar *title, const gchar *custom_fields fmt_data *cfmt, *last_cfmt; gint colnr; - cfmt = (fmt_data *) g_malloc(sizeof(fmt_data)); + cfmt = g_new(fmt_data, 1); /* * Because a single underscore is interpreted as a signal that the next character * is going to be marked as accelerator for this header (i.e. is going to be diff --git a/ui/profile.c b/ui/profile.c index a6742e5320..3a24f97ae1 100644 --- a/ui/profile.c +++ b/ui/profile.c @@ -45,7 +45,7 @@ add_profile_entry(GList *fl, const char *profilename, const char *reference, int { profile_def *profile; - profile = (profile_def *) g_malloc0(sizeof(profile_def)); + profile = g_new0(profile_def, 1); profile->name = g_strdup(profilename); profile->reference = g_strdup(reference); profile->status = status; diff --git a/ui/recent.c b/ui/recent.c index 8c24b32320..5bb4d54d0b 100644 --- a/ui/recent.c +++ b/ui/recent.c @@ -214,7 +214,7 @@ window_geom_save(const gchar *name, window_geometry_t *geom) } /* g_malloc and insert the new one */ - work = (window_geometry_t *)g_malloc(sizeof(window_geometry_t)); + work = g_new(window_geometry_t, 1); *work = *geom; key = g_strdup(name); work->key = key; @@ -1155,7 +1155,7 @@ read_set_recent_pair_static(gchar *key, const gchar *value, col_l_elt = g_list_first(col_l); while (col_l_elt) { gchar *fmt = g_strdup((const gchar *)col_l_elt->data); - cfmt = (col_width_data *) g_malloc(sizeof(col_width_data)); + cfmt = g_new(col_width_data, 1); if (strncmp(fmt, cust_format, cust_format_len) != 0) { cfmt->cfmt = get_column_format_from_str(fmt); cfmt->cfield = NULL; @@ -1511,7 +1511,7 @@ recent_set_column_width(gint col, gint width) } if (!found) { - col_w = (col_width_data *) g_malloc(sizeof(col_width_data)); + col_w = g_new(col_width_data, 1); col_w->cfmt = cfmt; col_w->cfield = g_strdup(cfield); col_w->width = width; @@ -1577,7 +1577,7 @@ recent_set_column_xalign(gint col, gchar xalign) } if (!found) { - col_w = (col_width_data *) g_malloc(sizeof(col_width_data)); + col_w = g_new(col_width_data, 1); col_w->cfmt = cfmt; col_w->cfield = g_strdup(cfield); col_w->width = 40; diff --git a/ui/tap-rlc-graph.c b/ui/tap-rlc-graph.c index f0f12862d9..7f20dcec78 100644 --- a/ui/tap-rlc-graph.c +++ b/ui/tap-rlc-graph.c @@ -182,7 +182,7 @@ static tap_packet_status rlc_lte_tap_for_graph_data(void *pct, packet_info *pinf rlchdr->isControlPDU)) { /* It matches. Copy segment details out of tap struct */ - struct rlc_segment *segment = (struct rlc_segment *)g_malloc(sizeof(struct rlc_segment)); + struct rlc_segment *segment = g_new(struct rlc_segment, 1); segment->next = NULL; segment->num = pinfo->num; segment->rel_secs = (guint32) pinfo->rel_ts.secs; diff --git a/ui/tap-rtp-common.c b/ui/tap-rtp-common.c index 613f8c5b1b..676c29a171 100644 --- a/ui/tap-rtp-common.c +++ b/ui/tap-rtp-common.c @@ -57,7 +57,7 @@ rtpstream_info_t *rtpstream_info_malloc_and_init(void) { rtpstream_info_t *dest; - dest = (rtpstream_info_t *)g_malloc(sizeof(rtpstream_info_t)); + dest = g_new(rtpstream_info_t, 1); rtpstream_info_init(dest); return dest; @@ -80,7 +80,7 @@ rtpstream_info_t *rtpstream_info_malloc_and_copy_deep(const rtpstream_info_t *sr { rtpstream_info_t *dest; - dest = (rtpstream_info_t *)g_malloc(sizeof(rtpstream_info_t)); + dest = g_new(rtpstream_info_t, 1); rtpstream_info_copy_deep(dest, src); return dest; diff --git a/ui/voip_calls.c b/ui/voip_calls.c index c52548a95d..1018ed47c0 100644 --- a/ui/voip_calls.c +++ b/ui/voip_calls.c @@ -326,7 +326,7 @@ add_to_graph(voip_calls_tapinfo_t *tapinfo, packet_info *pinfo, epan_dissect_t * return; } - gai = (seq_analysis_item_t *)g_malloc0(sizeof(seq_analysis_item_t)); + gai = g_new0(seq_analysis_item_t, 1); gai->frame_number = pinfo->num; copy_address(&(gai->src_addr),src_addr); copy_address(&(gai->dst_addr),dst_addr); @@ -446,7 +446,7 @@ static void insert_to_graph_t38(voip_calls_tapinfo_t *tapinfo, packet_info *pinf gboolean inserted; gchar time_str[COL_MAX_LEN]; - new_gai = (seq_analysis_item_t *)g_malloc0(sizeof(seq_analysis_item_t)); + new_gai = g_new0(seq_analysis_item_t, 1); new_gai->frame_number = frame_num; copy_address(&(new_gai->src_addr),src_addr); copy_address(&(new_gai->dst_addr),dst_addr); @@ -731,7 +731,7 @@ rtp_draw(void *tap_offset_ptr) (rtp_listinfo->is_srtp)?"SRTP":"RTP", rtp_listinfo->packet_count, duration/1000,(duration%1000), rtp_listinfo->id.ssrc); } else { - new_gai = (seq_analysis_item_t *)g_malloc0(sizeof(seq_analysis_item_t)); + new_gai = g_new0(seq_analysis_item_t, 1); new_gai->frame_number = rtp_listinfo->start_fd->num; copy_address(&(new_gai->src_addr),&(rtp_listinfo->id.src_addr)); copy_address(&(new_gai->dst_addr),&(rtp_listinfo->id.dst_addr)); @@ -940,7 +940,7 @@ t38_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *edt, const /* not in the list? then create a new entry */ if (callsinfo==NULL) { - callsinfo = (voip_calls_info_t *)g_malloc0(sizeof(voip_calls_info_t)); + callsinfo = g_new0(voip_calls_info_t, 1); callsinfo->call_active_state = VOIP_ACTIVE; callsinfo->call_state = VOIP_UNKNOWN; callsinfo->from_identity=g_strdup("T38 Media only"); @@ -1135,7 +1135,7 @@ sip_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *edt , if (tapinfo->fs_option == FLOW_ALL || (tapinfo->fs_option == FLOW_ONLY_INVITES && strcmp(pi->request_method,"INVITE")==0)) { - callsinfo = (voip_calls_info_t *)g_malloc0(sizeof(voip_calls_info_t)); + callsinfo = g_new0(voip_calls_info_t, 1); callsinfo->call_active_state = VOIP_ACTIVE; callsinfo->call_state = VOIP_CALL_SETUP; callsinfo->from_identity=g_strdup(pi->tap_from_addr); @@ -1373,7 +1373,7 @@ isup_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *edt, -i.e. if this session is a call*/ if ((callsinfo==NULL) &&(pi->message_type==1)) { - callsinfo = (voip_calls_info_t *)g_malloc0(sizeof(voip_calls_info_t)); + callsinfo = g_new0(voip_calls_info_t, 1); callsinfo->call_active_state = VOIP_ACTIVE; callsinfo->call_state = VOIP_UNKNOWN; copy_address(&(callsinfo->initial_speaker),&(pinfo->src)); @@ -1789,7 +1789,7 @@ q931_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *edt, /* if it is a new call, add it to the list */ if (!callsinfo) { - callsinfo = (voip_calls_info_t *)g_malloc0(sizeof(voip_calls_info_t)); + callsinfo = g_new0(voip_calls_info_t, 1); callsinfo->call_active_state = VOIP_ACTIVE; callsinfo->call_state = VOIP_CALL_SETUP; callsinfo->from_identity=g_strdup(tapinfo->q931_calling_number); @@ -2007,7 +2007,7 @@ h225_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *edt, /* not in the list? then create a new entry */ if (callsinfo==NULL) { - callsinfo = (voip_calls_info_t *)g_malloc0(sizeof(voip_calls_info_t)); + callsinfo = g_new0(voip_calls_info_t, 1); callsinfo->call_active_state = VOIP_ACTIVE; callsinfo->call_state = VOIP_UNKNOWN; callsinfo->from_identity=g_strdup(""); @@ -2059,7 +2059,7 @@ h225_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *edt, /* this is still IPv4 only, because the dissector is */ if (pi->is_h245 == TRUE) { - h245_add = (h245_address_t *)g_malloc(sizeof (h245_address_t)); + h245_add = g_new(h245_address_t, 1); alloc_address_wmem(NULL, &h245_add->h245_address, AT_IPv4, 4, &pi->h245_address); h245_add->h245_port = pi->h245_port; add_h245_Address(tmp_h323info, h245_add); @@ -2650,7 +2650,7 @@ mgcp_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *edt, /* not in the list? then create a new entry */ if (callsinfo==NULL) { - callsinfo = (voip_calls_info_t *)g_malloc0(sizeof(voip_calls_info_t)); + callsinfo = g_new0(voip_calls_info_t, 1); callsinfo->call_active_state = VOIP_ACTIVE; callsinfo->call_state = VOIP_CALL_SETUP; if (fromEndpoint) { @@ -2863,7 +2863,7 @@ actrace_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *e /* if it is a new call, add it to the list */ if (!callsinfo) { - callsinfo = (voip_calls_info_t *)g_malloc0(sizeof(voip_calls_info_t)); + callsinfo = g_new0(voip_calls_info_t, 1); callsinfo->call_active_state = VOIP_ACTIVE; callsinfo->call_state = VOIP_CALL_SETUP; callsinfo->from_identity=g_strdup("N/A"); @@ -2997,7 +2997,7 @@ h248_calls_packet_common(voip_calls_tapinfo_t *tapinfo, packet_info *pinfo, epan if (callsinfo==NULL) { - callsinfo = (voip_calls_info_t *)g_malloc0(sizeof(voip_calls_info_t)); + callsinfo = g_new0(voip_calls_info_t, 1); callsinfo->call_state = VOIP_NO_STATE; callsinfo->call_active_state = VOIP_ACTIVE; callsinfo->from_identity = g_strdup_printf("%s : %.8x", mgw_addr, cmd->ctx->id); @@ -3161,7 +3161,7 @@ sccp_calls(voip_calls_tapinfo_t *tapinfo, packet_info *pinfo, epan_dissect_t *ed } if (callsinfo==NULL) { - callsinfo = (voip_calls_info_t *)g_malloc0(sizeof(voip_calls_info_t)); + callsinfo = g_new0(voip_calls_info_t, 1); callsinfo->call_state = VOIP_CALL_SETUP; callsinfo->call_active_state = VOIP_ACTIVE; if ( assoc->calling_party ) { @@ -3404,7 +3404,7 @@ unistim_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *e /* If new add to list */ if (callsinfo==NULL) { - callsinfo = (voip_calls_info_t *)g_malloc0(sizeof(voip_calls_info_t)); + callsinfo = g_new0(voip_calls_info_t, 1); callsinfo->call_active_state = VOIP_ACTIVE; callsinfo->call_state = VOIP_CALL_SETUP; callsinfo->from_identity=g_strdup_printf("%x",pi->termid); @@ -3660,7 +3660,7 @@ unistim_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *e * ineffective. * Sometimes calls start immediately with open stream. */ - callsinfo = (voip_calls_info_t *)g_malloc0(sizeof(voip_calls_info_t)); + callsinfo = g_new0(voip_calls_info_t, 1); callsinfo->call_active_state = VOIP_ACTIVE; callsinfo->call_state = VOIP_CALL_SETUP; callsinfo->from_identity=g_strdup("UNKNOWN"); @@ -3893,7 +3893,7 @@ skinny_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *ed phone = &(pinfo->src); if (callsinfo==NULL) { - callsinfo = (voip_calls_info_t *)g_malloc0(sizeof(voip_calls_info_t)); + callsinfo = g_new0(voip_calls_info_t, 1); callsinfo->call_state = VOIP_NO_STATE; callsinfo->call_active_state = VOIP_ACTIVE; /* callsinfo->from_identity = g_strdup_printf("%s : %.8x", "Skinny", 1); */ @@ -4049,7 +4049,7 @@ iax2_calls_packet( void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *edt /* We only care about real calls, i.e., no registration stuff */ if (ii->ftype != AST_FRAME_IAX || ii->csub != IAX_COMMAND_NEW) return TAP_PACKET_DONT_REDRAW; - callsinfo = (voip_calls_info_t *)g_malloc0(sizeof(voip_calls_info_t)); + callsinfo = g_new0(voip_calls_info_t, 1); callsinfo->call_state = VOIP_NO_STATE; callsinfo->call_active_state = VOIP_ACTIVE; callsinfo->prot_info=g_malloc(sizeof(iax2_info_t)); @@ -4173,7 +4173,7 @@ voip_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *edt, } if (callsinfo == NULL) { - callsinfo = (voip_calls_info_t *)g_malloc0(sizeof(voip_calls_info_t)); + callsinfo = g_new0(voip_calls_info_t, 1); callsinfo->call_active_state = pi->call_active_state; callsinfo->call_state = pi->call_state; callsinfo->call_id=g_strdup((pi->call_id)?pi->call_id:""); |