diff options
author | Ulf Lamping <ulf.lamping@web.de> | 2005-08-05 23:58:58 +0000 |
---|---|---|
committer | Ulf Lamping <ulf.lamping@web.de> | 2005-08-05 23:58:58 +0000 |
commit | 149786d5636601988d126927a64ce517690ee49c (patch) | |
tree | cb3c54c2b0f0cac5cf1c2e1cb602d09ad46ec3d1 | |
parent | 1106ac410594177a2acb3987d24c80e742bd29fa (diff) | |
download | wireshark-149786d5636601988d126927a64ce517690ee49c.tar.gz wireshark-149786d5636601988d126927a64ce517690ee49c.tar.bz2 wireshark-149786d5636601988d126927a64ce517690ee49c.zip |
replace malloc and alike calls by their GLib pendants -> g_malloc
svn path=/trunk/; revision=15232
-rw-r--r-- | capture_stop_conditions.c | 8 | ||||
-rw-r--r-- | conditions.c | 24 | ||||
-rw-r--r-- | docbook/edg_src/EDG_chapter_dissection.xml | 8 | ||||
-rw-r--r-- | epan/dissectors/packet-bssgp.c | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-dcm.c | 2 | ||||
-rw-r--r-- | epan/follow.c | 12 | ||||
-rw-r--r-- | epan/tap.c | 2 | ||||
-rw-r--r-- | gtk/sctp_assoc_analyse.c | 4 | ||||
-rw-r--r-- | gtk/sctp_stat.c | 40 | ||||
-rw-r--r-- | gtk/tcp_graph.c | 80 | ||||
-rw-r--r-- | gtk/ui_util.c | 2 |
11 files changed, 93 insertions, 93 deletions
diff --git a/capture_stop_conditions.c b/capture_stop_conditions.c index 1eb7a443cd..6c1b9e83c7 100644 --- a/capture_stop_conditions.c +++ b/capture_stop_conditions.c @@ -84,7 +84,7 @@ typedef struct _cnd_timeout_dat{ static condition* _cnd_constr_timeout(condition* cnd, va_list ap){ cnd_timeout_dat *data = NULL; /* allocate memory */ - if((data = (cnd_timeout_dat*)malloc(sizeof(cnd_timeout_dat))) == NULL) + if((data = (cnd_timeout_dat*)g_malloc(sizeof(cnd_timeout_dat))) == NULL) return NULL; /* initialize user data */ data->start_time = time(NULL); @@ -101,7 +101,7 @@ static condition* _cnd_constr_timeout(condition* cnd, va_list ap){ */ static void _cnd_destr_timeout(condition* cnd){ /* free memory */ - free(cnd_get_user_data(cnd)); + g_free(cnd_get_user_data(cnd)); } /* END _cnd_destr_timeout() */ /* @@ -159,7 +159,7 @@ typedef struct _cnd_capturesize_dat{ static condition* _cnd_constr_capturesize(condition* cnd, va_list ap){ cnd_capturesize_dat *data = NULL; /* allocate memory */ - if((data = (cnd_capturesize_dat*)malloc(sizeof(cnd_capturesize_dat))) == NULL) + if((data = (cnd_capturesize_dat*)g_malloc(sizeof(cnd_capturesize_dat))) == NULL) return NULL; /* initialize user data */ data->max_capture_size = va_arg(ap, long); @@ -175,7 +175,7 @@ static condition* _cnd_constr_capturesize(condition* cnd, va_list ap){ */ static void _cnd_destr_capturesize(condition* cnd){ /* free memory */ - free(cnd_get_user_data(cnd)); + g_free(cnd_get_user_data(cnd)); } /* END _cnd_destr_capturesize() */ /* diff --git a/conditions.c b/conditions.c index f894312dba..939ed260e0 100644 --- a/conditions.c +++ b/conditions.c @@ -61,13 +61,13 @@ condition* cnd_new(const char* class_id, ...){ if((cls = (_cnd_class*)g_hash_table_lookup(classes, class_id)) == NULL) return NULL; /* initialize the basic structure */ - if((cnd_ref = (condition*)malloc(sizeof(condition))) == NULL) return NULL; + if((cnd_ref = (condition*)g_malloc(sizeof(condition))) == NULL) return NULL; cnd_ref->user_data = NULL; cnd_ref->eval_func = cls->eval_func; cnd_ref->reset_func = cls->reset_func; /* copy the class id */ - if((id = (char*)malloc(strlen(class_id)+1)) == NULL){ - free(cnd_ref); + if((id = (char*)g_malloc(strlen(class_id)+1)) == NULL){ + g_free(cnd_ref); return NULL; } strcpy(id, class_id); @@ -78,8 +78,8 @@ condition* cnd_new(const char* class_id, ...){ va_end(ap); /* check for successful construction */ if(cnd == NULL){ - free(cnd_ref); - free(id); + g_free(cnd_ref); + g_free(id); } return cnd; } /* END cnd_new() */ @@ -96,9 +96,9 @@ void cnd_delete(condition *cnd){ /* call class specific destructor */ if(cls != NULL) (cls->destr_func)(cnd); /* free memory */ - free(cnd->class_id); + g_free(cnd->class_id); /* free basic structure */ - free(cnd); + g_free(cnd); } /* END cnd_delete() */ gboolean cnd_eval(condition *cnd, ...){ @@ -143,11 +143,11 @@ gboolean cnd_register_class(const char* class_id, return FALSE; /* GHashTable keys need to be persistent for the lifetime of the hash table. Allocate memory and copy the class id which we use as key. */ - if((key = (char*)malloc(strlen(class_id)+1)) == NULL) return FALSE; + if((key = (char*)g_malloc(strlen(class_id)+1)) == NULL) return FALSE; strcpy(key, class_id); /* initialize class structure */ - if((cls = (_cnd_class*)malloc(sizeof(_cnd_class))) == NULL){ - free(key); + if((cls = (_cnd_class*)g_malloc(sizeof(_cnd_class))) == NULL){ + g_free(key); return FALSE; } cls->constr_func = constr_func; @@ -174,10 +174,10 @@ void cnd_unregister_class(const char* class_id){ /* remove constructor from hash table */ g_hash_table_remove(classes, class_id); /* free the key */ - free(pkey); + g_free(pkey); pkey = NULL; /* free the value */ - free(cls); + g_free(cls); } /* END cnd_unregister_class() */ /* diff --git a/docbook/edg_src/EDG_chapter_dissection.xml b/docbook/edg_src/EDG_chapter_dissection.xml index 0e91c59b69..47e70c9879 100644 --- a/docbook/edg_src/EDG_chapter_dissection.xml +++ b/docbook/edg_src/EDG_chapter_dissection.xml @@ -671,14 +671,14 @@ dissect_foo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (flags & FLAG_COMPRESSED) { /* the remainder of the packet is compressed */ guint16 orig_size = tvb_get_ntohs(tvb, offset); offset += 2; guchar *decompressed_buffer; /* Buffers for decompression */ - decompressed_buffer = (guchar*) malloc (orig_size); + decompressed_buffer = (guchar*) g_malloc (orig_size); decompress_packet (tvb_get_ptr(tvb, offset, -1), tvb_length_remaining(tvb, offset), decompressed_buffer, orig_size); /* Now re-setup the tvb buffer to have the new data */ next_tvb = tvb_new_real_data(decompressed_buffer, orig_size, orig_size); tvb_set_child_real_data_tvbuff(tvb, next_tvb); add_new_data_source(pinfo, next_tvb, "Decompressed Data"); - tvb_set_free_cb(next_tvb, free); + tvb_set_free_cb(next_tvb, g_free); } else { next_tvb = tvb_new_subset(tvb, offset, -1, -1); } @@ -696,7 +696,7 @@ dissect_foo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) </para> <para> So armed with the size, a buffer is allocated to receive the uncompressed - data using malloc, and the packet is decompressed into it. + data using g_malloc, and the packet is decompressed into it. The tvb_get_ptr function is useful to get a pointer to the raw data of the packet from the offset onwards. In this case the decompression routine also needs to know the length, which is @@ -709,7 +709,7 @@ dissect_foo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) Finally we add this data as a new data source, so that the detailed display can show the decompressed bytes as well as the original. One procedural step is to add a handler to free the data when its no longer needed. - In this case as malloc was used to allocate the memory, free is the appropriate + In this case as g_malloc was used to allocate the memory, g_free is the appropriate function. </para> <para> diff --git a/epan/dissectors/packet-bssgp.c b/epan/dissectors/packet-bssgp.c index 162a8e65ba..38a11acac9 100644 --- a/epan/dissectors/packet-bssgp.c +++ b/epan/dissectors/packet-bssgp.c @@ -4124,7 +4124,7 @@ decode_ie(bssgp_ie_t *ie, build_info_t *bi) { } if (use_default_ie_name) { - ie->name = malloc(strlen(iename) + 1); + ie->name = g_malloc(strlen(iename) + 1); if (ie->name == NULL) { #ifdef BSSGP_DEBUG proto_tree_add_text(bi->bssgp_tree, bi->tvb, bi->offset, 1, @@ -4345,7 +4345,7 @@ decode_ie(bssgp_ie_t *ie, build_info_t *bi) { } if (use_default_ie_name) { /* Memory has been allocated; free it */ - free(ie->name); + g_free(ie->name); ie->name = NULL; } } diff --git a/epan/dissectors/packet-dcm.c b/epan/dissectors/packet-dcm.c index 063386f110..4eed7dae5d 100644 --- a/epan/dissectors/packet-dcm.c +++ b/epan/dissectors/packet-dcm.c @@ -303,7 +303,7 @@ mkds(void) { dcmState_t *ds; - if (NULL == (ds = (dcmState_t *) malloc(sizeof(dcmState_t)))) { + if (NULL == (ds = (dcmState_t *) g_malloc(sizeof(dcmState_t)))) { return NULL; } ds->pdu = 0; diff --git a/epan/follow.c b/epan/follow.c index 19e14303b2..429e077338 100644 --- a/epan/follow.c +++ b/epan/follow.c @@ -257,8 +257,8 @@ reassemble_tcp( gulong sequence, gulong length, const char* data, else { /* out of order packet */ if(data_length > 0 && sequence > seq[src_index] ) { - tmp_frag = (tcp_frag *)malloc( sizeof( tcp_frag ) ); - tmp_frag->data = (guchar *)malloc( data_length ); + tmp_frag = (tcp_frag *)g_malloc( sizeof( tcp_frag ) ); + tmp_frag->data = (guchar *)g_malloc( data_length ); tmp_frag->seq = sequence; tmp_frag->len = length; tmp_frag->data_len = data_length; @@ -293,8 +293,8 @@ check_fragments( int index, tcp_stream_chunk *sc ) { } else { frags[index] = current->next; } - free( current->data ); - free( current ); + g_free( current->data ); + g_free( current ); return 1; } prev = current; @@ -319,8 +319,8 @@ reset_tcp_reassembly() { current = frags[i]; while( current ) { next = current->next; - free( current->data ); - free( current ); + g_free( current->data ); + g_free( current ); current = next; } frags[i] = NULL; diff --git a/epan/tap.c b/epan/tap.c index 390824e417..9f559f6040 100644 --- a/epan/tap.c +++ b/epan/tap.c @@ -121,7 +121,7 @@ register_tap_listener_cmd_arg(const char *cmd, void (*func)(char *arg)) { tap_cmd_arg *newtca; - newtca=malloc(sizeof(tap_cmd_arg)); + newtca=g_malloc(sizeof(tap_cmd_arg)); newtca->next=tap_cmd_arg_list; tap_cmd_arg_list=newtca; newtca->cmd=cmd; diff --git a/gtk/sctp_assoc_analyse.c b/gtk/sctp_assoc_analyse.c index 25e7a5a1ef..15881c4634 100644 --- a/gtk/sctp_assoc_analyse.c +++ b/gtk/sctp_assoc_analyse.c @@ -752,9 +752,9 @@ void sctp_analyse_cb(struct sctp_analyse* u_data) return; } - ip_src = malloc(edt->pi.src.len); + ip_src = g_malloc(edt->pi.src.len); memcpy(ip_src, edt->pi.src.data, edt->pi.src.len); - ip_dst = malloc(edt->pi.dst.len); + ip_dst = g_malloc(edt->pi.dst.len); memcpy(ip_dst, edt->pi.dst.data, edt->pi.dst.len); srcport = edt->pi.srcport; dstport = edt->pi.destport; diff --git a/gtk/sctp_stat.c b/gtk/sctp_stat.c index e712d7cb62..2b2dc3b54d 100644 --- a/gtk/sctp_stat.c +++ b/gtk/sctp_stat.c @@ -791,7 +791,7 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v tmp_info.src.len = 16; } - addr = malloc(tmp_info.src.len); + addr = g_malloc(tmp_info.src.len); memcpy(addr, sctp_info->ip_src.data, tmp_info.src.len); tmp_info.src.data = addr; @@ -808,7 +808,7 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v tmp_info.dst.len = 16; } - addr = malloc(tmp_info.dst.len); + addr = g_malloc(tmp_info.dst.len); memcpy(addr, sctp_info->ip_dst.data, tmp_info.dst.len); tmp_info.dst.data = addr; @@ -839,12 +839,12 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v memset(info, 0, sizeof(sctp_assoc_info_t)); info->src.type = tmp_info.src.type; info->src.len = tmp_info.src.len; - addr = malloc(tmp_info.dst.len); + addr = g_malloc(tmp_info.dst.len); memcpy(addr,(tmp_info.src.data), tmp_info.src.len); info->src.data = addr; info->dst.type = tmp_info.dst.type; info->dst.len = tmp_info.dst.len; - addr = malloc(tmp_info.dst.len); + addr = g_malloc(tmp_info.dst.len); memcpy(addr, (tmp_info.dst.data), tmp_info.dst.len); info->dst.data = addr; info->port1 = tmp_info.port1; @@ -904,18 +904,18 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v sack->tsns = NULL; sack->src.type=tsn->src.type = tmp_info.src.type; sack->src.len=tsn->src.len = tmp_info.src.len; - addr = malloc(tmp_info.src.len); + addr = g_malloc(tmp_info.src.len); memcpy(addr, tmp_info.src.data, tmp_info.src.len); tsn->src.data = addr; - addr = malloc(tmp_info.src.len); + addr = g_malloc(tmp_info.src.len); memcpy(addr, tmp_info.src.data, tmp_info.src.len); sack->src.data = addr; sack->dst.type = tsn->dst.type = tmp_info.dst.type; sack->dst.len =tsn->dst.len = tmp_info.dst.len; - addr = malloc(tmp_info.dst.len); + addr = g_malloc(tmp_info.dst.len); memcpy(addr, tmp_info.dst.data, tmp_info.dst.len); tsn->dst.data = addr; - addr = malloc(tmp_info.dst.len); + addr = g_malloc(tmp_info.dst.len); memcpy(addr, tmp_info.dst.data, tmp_info.dst.len); sack->dst.data = addr; sack->secs=tsn->secs = (guint32)pinfo->fd->rel_secs; @@ -956,7 +956,7 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v store = g_malloc(sizeof (address)); store->type = AT_IPv4;; store->len = 4; - store->data = malloc(4); + store->data = g_malloc(4); tvb_memcpy(sctp_info->tvb[chunk_number], (guint8 *)(store->data),IPV4_ADDRESS_OFFSET, 4); info = add_address(store, info, 1); } @@ -965,7 +965,7 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v store = g_malloc(sizeof (address)); store->type = AT_IPv6;; store->len = 16; - store->data = malloc(16); + store->data = g_malloc(16); tvb_memcpy(sctp_info->tvb[chunk_number], (guint8 *)(store->data),IPV6_ADDRESS_OFFSET, IPV6_ADDRESS_LENGTH); info = add_address(store, info, 1); } @@ -1070,14 +1070,14 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v store = g_malloc(sizeof (address)); store->type = tmp_info.src.type; store->len = tmp_info.src.len; - addr = malloc(tmp_info.src.len); + addr = g_malloc(tmp_info.src.len); memcpy(addr,(tmp_info.src.data),tmp_info.src.len); store->data = addr; info = add_address(store, info, 1); store = g_malloc(sizeof (address)); store->type = tmp_info.dst.type; store->len = tmp_info.dst.len; - addr = malloc(tmp_info.dst.len); + addr = g_malloc(tmp_info.dst.len); memcpy(addr,(tmp_info.dst.data),tmp_info.dst.len); store->data = addr; info = add_address(store, info, 2); @@ -1118,18 +1118,18 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v sack->tsns = NULL; sack->src.type = tsn->src.type = tmp_info.src.type; sack->src.len = tsn->src.len = tmp_info.src.len; - addr = malloc(tmp_info.src.len); + addr = g_malloc(tmp_info.src.len); memcpy(addr, tmp_info.src.data, tmp_info.src.len); tsn->src.data = addr; - addr = malloc(tmp_info.src.len); + addr = g_malloc(tmp_info.src.len); memcpy(addr, tmp_info.src.data, tmp_info.src.len); sack->src.data = addr; sack->dst.type = tsn->dst.type = tmp_info.dst.type; sack->dst.len = tsn->dst.len = tmp_info.dst.len; - addr = malloc(tmp_info.dst.len); + addr = g_malloc(tmp_info.dst.len); memcpy(addr, tmp_info.dst.data, tmp_info.dst.len); tsn->dst.data = addr; - addr = malloc(tmp_info.dst.len); + addr = g_malloc(tmp_info.dst.len); memcpy(addr, tmp_info.dst.data, tmp_info.dst.len); sack->dst.data = addr; sack->secs=tsn->secs = (guint32)pinfo->fd->rel_secs; @@ -1160,7 +1160,7 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v store = g_malloc(sizeof (address)); store->type = tmp_info.src.type; store->len = tmp_info.src.len; - addr = malloc(tmp_info.src.len); + addr = g_malloc(tmp_info.src.len); memcpy(addr,(tmp_info.src.data),tmp_info.src.len); store->data = addr; @@ -1172,7 +1172,7 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v store = g_malloc(sizeof (address)); store->type = tmp_info.dst.type; store->len = tmp_info.dst.len; - addr = malloc(tmp_info.dst.len); + addr = g_malloc(tmp_info.dst.len); memcpy(addr,(tmp_info.dst.data),tmp_info.dst.len); store->data = addr; @@ -1222,7 +1222,7 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v store = g_malloc(sizeof (address)); store->type = AT_IPv4;; store->len = 4; - store->data = malloc(4); + store->data = g_malloc(4); tvb_memcpy(sctp_info->tvb[chunk_number], (guint8 *)(store->data),IPV4_ADDRESS_OFFSET, 4); info = add_address(store, info, info->direction); } @@ -1231,7 +1231,7 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v store = g_malloc(sizeof (address)); store->type = AT_IPv6;; store->len = 16; - store->data = malloc(16); + store->data = g_malloc(16); tvb_memcpy(sctp_info->tvb[chunk_number], (guint8 *)(store->data),IPV6_ADDRESS_OFFSET, IPV6_ADDRESS_LENGTH); info = add_address(store, info, info->direction); } diff --git a/gtk/tcp_graph.c b/gtk/tcp_graph.c index 5ab653c2e2..c79ca601b2 100644 --- a/gtk/tcp_graph.c +++ b/gtk/tcp_graph.c @@ -1604,11 +1604,11 @@ static struct graph *graph_new (void) { struct graph *g; - g = (struct graph * )calloc (1, sizeof (struct graph)); + g = (struct graph * )g_malloc0 (sizeof (struct graph)); graph_element_lists_initialize (g); - g->x_axis = (struct axis * )calloc (1, sizeof (struct axis)); - g->y_axis = (struct axis * )calloc (1, sizeof (struct axis)); + g->x_axis = (struct axis * )g_malloc0 (sizeof (struct axis)); + g->y_axis = (struct axis * )g_malloc0 (sizeof (struct axis)); g->x_axis->g = g; g->x_axis->flags = 0; g->x_axis->flags |= AXIS_ORIENTATION; @@ -1725,9 +1725,9 @@ static void graph_destroy (struct graph *g) #endif gdk_pixmap_unref (g->pixmap[0]); gdk_pixmap_unref (g->pixmap[1]); - free (g->x_axis); - free (g->y_axis); - free (g->title); + g_free (g->x_axis); + g_free (g->y_axis); + g_free (g->title); graph_segment_list_free (g); graph_element_lists_free (g); #if 0 @@ -1740,7 +1740,7 @@ static void graph_destroy (struct graph *g) graphs = g->next; else p->next = g->next; - free (g); + g_free (g); #if 0 for (tmp=graphs; tmp; tmp=tmp->next) printf ("%p next: %p\n", tmp, tmp->next); @@ -1971,7 +1971,7 @@ static void graph_segment_list_free (struct graph *g) while (g->segments) { segment = g->segments->next; - free (g->segments); + g_free (g->segments); g->segments = segment; } g->segments = NULL; @@ -1979,7 +1979,7 @@ static void graph_segment_list_free (struct graph *g) static void graph_element_lists_initialize (struct graph *g) { - g->elists = (struct element_list *)calloc (1, sizeof (struct element_list)); + g->elists = (struct element_list *)g_malloc0 (sizeof (struct element_list)); } static void graph_element_lists_make (struct graph *g) @@ -2011,18 +2011,18 @@ static void graph_element_lists_free (struct graph *g) #if 0 for (list=g->elists; list; list=list->next) - free (list->elements); + g_free (list->elements); while (g->elists->next) { list = g->elists->next->next; - free (g->elists->next); + g_free (g->elists->next); g->elists->next = list; } #endif for (list=g->elists; list; list=next_list) { - free (list->elements); + g_free (list->elements); next_list = list->next; - free (list); + g_free (list); } g->elists = NULL; /* just to make debugging easier */ } @@ -2210,7 +2210,7 @@ static void axis_destroy (struct axis *axis) { gdk_pixmap_unref (axis->pixmap[0]); gdk_pixmap_unref (axis->pixmap[1]); - free (axis->label); + g_free (axis->label); } static void axis_display (struct axis *axis) @@ -2716,7 +2716,7 @@ static void magnify_create (struct graph *g, int x, int y) struct ipoint pos, offsetpos; GdkEvent *e=NULL; - mg = g->magnify.g = (struct graph * )malloc (sizeof (struct graph)); + mg = g->magnify.g = (struct graph * )g_malloc (sizeof (struct graph)); memcpy ((void * )mg, (void * )g, sizeof (struct graph)); mg->toplevel = dlg_window_new("tcp graph magnify"); @@ -2742,7 +2742,7 @@ static void magnify_create (struct graph *g, int x, int y) new_list = mg->elists; for ( ; list; list=list->next) { new_list->next = - (struct element_list * )malloc (sizeof (struct element_list)); + (struct element_list * )g_malloc (sizeof (struct element_list)); new_list = new_list->next; new_list->next = NULL; new_list->elements = NULL; @@ -2806,13 +2806,13 @@ static void magnify_destroy (struct graph *g) gdk_pixmap_unref (mg->pixmap[0]); gdk_pixmap_unref (mg->pixmap[1]); for (list=mg->elists; list; list=list->next) - free (list->elements); + g_free (list->elements); while (mg->elists->next) { list = mg->elists->next->next; - free (mg->elists->next); + g_free (mg->elists->next); mg->elists->next = list; } - free (g->magnify.g); + g_free (g->magnify.g); g->magnify.active = 0; } @@ -3297,14 +3297,14 @@ static void tseq_stevens_read_config (struct graph *g) g->s.tseq_stevens.seq_height = 4; g->s.tseq_stevens.flags = 0; - g->title = (char ** )malloc (2 * sizeof (char *)); + g->title = (char ** )g_malloc (2 * sizeof (char *)); g->title[0] = "Time/Sequence Graph"; g->title[1] = NULL; - g->y_axis->label = (char ** )malloc (3 * sizeof (char * )); + g->y_axis->label = (char ** )g_malloc (3 * sizeof (char * )); g->y_axis->label[0] = "number[B]"; g->y_axis->label[1] = "Sequence"; g->y_axis->label[2] = NULL; - g->x_axis->label = (char ** )malloc (2 * sizeof (char * )); + g->x_axis->label = (char ** )g_malloc (2 * sizeof (char * )); g->x_axis->label[0] = "Time[s]"; g->x_axis->label[1] = NULL; } @@ -3397,7 +3397,7 @@ static void tseq_stevens_make_elmtlist (struct graph *g) debug(DBS_FENTRY) puts ("tseq_stevens_make_elmtlist()"); if (g->elists->elements == NULL) { int n = 1 + get_num_dsegs (g); - e = elements = (struct element * )malloc (n*sizeof (struct element)); + e = elements = (struct element * )g_malloc (n*sizeof (struct element)); } else e = elements = g->elists->elements; @@ -3512,18 +3512,18 @@ static void tseq_tcptrace_read_config (struct graph *g) gdk_gc_set_foreground (g->s.tseq_tcptrace.gc_ack[1], &color); g->elists->next = (struct element_list * ) - malloc (sizeof (struct element_list)); + g_malloc (sizeof (struct element_list)); g->elists->next->next = NULL; g->elists->next->elements = NULL; - g->title = (char ** )malloc (2 * sizeof (char *)); + g->title = (char ** )g_malloc (2 * sizeof (char *)); g->title[0] = "Time/Sequence Graph"; g->title[1] = NULL; - g->y_axis->label = (char ** )malloc (3 * sizeof (char * )); + g->y_axis->label = (char ** )g_malloc (3 * sizeof (char * )); g->y_axis->label[0] = "number[B]"; g->y_axis->label[1] = "Sequence"; g->y_axis->label[2] = NULL; - g->x_axis->label = (char ** )malloc (2 * sizeof (char * )); + g->x_axis->label = (char ** )g_malloc (2 * sizeof (char * )); g->x_axis->label[0] = "Time[s]"; g->x_axis->label[1] = NULL; } @@ -3544,13 +3544,13 @@ static void tseq_tcptrace_make_elmtlist (struct graph *g) if (g->elists->elements == NULL) { int n = 1 + 4*get_num_acks(g); - e0 = elements0 = (struct element * )malloc (n*sizeof (struct element)); + e0 = elements0 = (struct element * )g_malloc (n*sizeof (struct element)); } else e0 = elements0 = g->elists->elements; if (g->elists->next->elements == NULL ) { int n = 1 + 3*get_num_dsegs(g); - e1 = elements1 = (struct element * )malloc (n*sizeof (struct element)); + e1 = elements1 = (struct element * )g_malloc (n*sizeof (struct element)); } else e1 = elements1 = g->elists->next->elements; @@ -3705,7 +3705,7 @@ static void tput_make_elmtlist (struct graph *g) if (g->elists->elements == NULL) { int n = 1 + get_num_dsegs (g); - e = elements = (struct element * )malloc (n*sizeof (struct element)); + e = elements = (struct element * )g_malloc (n*sizeof (struct element)); } else e = elements = g->elists->elements; @@ -3788,14 +3788,14 @@ static void tput_read_config (struct graph *g) g->s.tput.height = 4; g->s.tput.nsegs = 20; - g->title = (char ** )malloc (2 * sizeof (char *)); + g->title = (char ** )g_malloc (2 * sizeof (char *)); g->title[0] = "Throughput Graph"; g->title[1] = NULL; - g->y_axis->label = (char ** )malloc (3 * sizeof (char * )); + g->y_axis->label = (char ** )g_malloc (3 * sizeof (char * )); g->y_axis->label[0] = "[B/s]"; g->y_axis->label[1] = "Throughput"; g->y_axis->label[2] = NULL; - g->x_axis->label = (char ** )malloc (2 * sizeof (char * )); + g->x_axis->label = (char ** )g_malloc (2 * sizeof (char * )); g->x_axis->label[0] = "Time[s]"; g->x_axis->label[1] = NULL; g->s.tput.flags = 0; @@ -3821,13 +3821,13 @@ static void rtt_read_config (struct graph *g) g->s.rtt.height = 4; g->s.rtt.flags = 0; - g->title = (char ** )malloc (2 * sizeof (char *)); + g->title = (char ** )g_malloc (2 * sizeof (char *)); g->title[0] = "Round Trip Time Graph"; g->title[1] = NULL; - g->y_axis->label = (char ** )malloc (3 * sizeof (char * )); + g->y_axis->label = (char ** )g_malloc (3 * sizeof (char * )); g->y_axis->label[0] = "RTT [s]"; g->y_axis->label[1] = NULL; - g->x_axis->label = (char ** )malloc (2 * sizeof (char * )); + g->x_axis->label = (char ** )g_malloc (2 * sizeof (char * )); g->x_axis->label[0] = "Sequence Number[B]"; g->x_axis->label[1] = NULL; } @@ -3911,7 +3911,7 @@ static struct unack *rtt_get_new_unack (double time, unsigned int seqno) { struct unack *u; - u = (struct unack * )malloc (sizeof (struct unack)); + u = (struct unack * )g_malloc (sizeof (struct unack)); if (!u) return NULL; u->next = NULL; @@ -3943,12 +3943,12 @@ static void rtt_delete_unack_from_list (struct unack **l, struct unack *dead) if (dead==list) { *l = list->next; - free (list); + g_free (list); } else for (u=list; u; u=u->next) if (u->next == dead) { u->next = u->next->next; - free (dead); + g_free (dead); break; } } @@ -3964,7 +3964,7 @@ static void rtt_make_elmtlist (struct graph *g) if (g->elists->elements == NULL) { int n = 1 + get_num_dsegs (g); - e = elements = (struct element * )malloc (n*sizeof (struct element)); + e = elements = (struct element * )g_malloc (n*sizeof (struct element)); } else { e = elements = g->elists->elements; } diff --git a/gtk/ui_util.c b/gtk/ui_util.c index 3c4c560ca1..9177cf9eb5 100644 --- a/gtk/ui_util.c +++ b/gtk/ui_util.c @@ -417,7 +417,7 @@ window_geom_save(const gchar *name, window_geometry_t *geom) g_free(work); } - /* malloc and insert the new one */ + /* g_malloc and insert the new one */ work = g_malloc(sizeof(*geom)); *work = *geom; key = g_strdup(name); |