replace malloc and alike calls by their GLib pendants -> g_malloc
authorUlf Lamping <ulf.lamping@web.de>
Fri, 5 Aug 2005 23:58:58 +0000 (23:58 -0000)
committerUlf Lamping <ulf.lamping@web.de>
Fri, 5 Aug 2005 23:58:58 +0000 (23:58 -0000)
svn path=/trunk/; revision=15232

capture_stop_conditions.c
conditions.c
docbook/edg_src/EDG_chapter_dissection.xml
epan/dissectors/packet-bssgp.c
epan/dissectors/packet-dcm.c
epan/follow.c
epan/tap.c
gtk/sctp_assoc_analyse.c
gtk/sctp_stat.c
gtk/tcp_graph.c
gtk/ui_util.c

index 1eb7a443cdaba58e5873d1d4c48cc1a67019e777..6c1b9e83c7a89169a3f4070bdc794aa18e07f610 100644 (file)
@@ -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() */
 
 /*
index f894312dbac6d55b52dda5047cb1e8a799c85329..939ed260e013f0d2877c7182a06b368421881f0a 100644 (file)
@@ -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() */
 
 /*
index 0e91c59b697128cba6b8c2f6ea47d18fca508c01..47e70c9879a6e1ba6e6f640da5e4ec3add78850b 100644 (file)
@@ -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> 
index 162a8e65ba445f998f0bae9d09c941152c9bd51a..38a11acac9e52cfd0a248e7eb21d3dd3b909cbe7 100644 (file)
@@ -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;
   }
 }
index 063386f110358c19db200e09ec0d41e30b2009a6..4eed7dae5da2a0ac6ca60819215722de4b5a8c92 100644 (file)
@@ -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;
index 19e14303b27c012eaeed504ce16ce029f7445de3..429e0773387eccd277d94dc69533f31e2bfec4e6 100644 (file)
@@ -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;
index 390824e41718f0c4c19363ea15986fe4c1be149b..9f559f60401735a834c0d18f6e0db48d4fff21f9 100644 (file)
@@ -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;
index 25e7a5a1effad17ab48fe94f09e4539c512129f4..15881c463445851cd1f7f698934112af09a05f58 100644 (file)
@@ -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;
index e712d7cb62d40db1a85c4ba35f936a4726828d58..2b2dc3b54d41efb3b09f2879f94938184ecf547e 100644 (file)
@@ -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);
                                        }
index 5ab653c2e2133a3dd20771d844a739e20e38c1a1..c79ca601b2909be60df98dced7f389d22fb07b8a 100644 (file)
@@ -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;
        }
index 3c4c560ca13d3f3c9919ead1020454644f95583e..9177cf9eb51a29d9a92c307424b0ffe3af63996d 100644 (file)
@@ -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);