fixing resource leaks
[oweals/gnunet.git] / src / ats / plugin_ats_proportional.c
index 82a41d39fef28e984ae596ab5cbab757215a2cab..03164f7ecf5b896841f7128b5fa3fca43325fcb5 100644 (file)
@@ -404,12 +404,11 @@ libgnunet_plugin_ats_proportional_init (void *cls)
 
   GNUNET_assert (NULL != env);
   GNUNET_assert(NULL != env->cfg);
-  GNUNET_assert(NULL != env->stats);
   GNUNET_assert(NULL != env->bandwidth_changed_cb);
   GNUNET_assert(NULL != env->get_preferences);
   GNUNET_assert(NULL != env->get_property);
 
-  s = GNUNET_malloc (sizeof (struct GAS_PROPORTIONAL_Handle));
+  s = GNUNET_new (struct GAS_PROPORTIONAL_Handle);
   s->env = env;
   env->sf.s_add = &GAS_proportional_address_add;
   env->sf.s_address_update_property = &GAS_proportional_address_property_changed;
@@ -454,7 +453,8 @@ libgnunet_plugin_ats_proportional_init (void *cls)
         "# ATS addresses %s total", cur->desc);
     GNUNET_asprintf (&cur->stat_active,
         "# ATS active addresses %s total", cur->desc);
-    LOG (GNUNET_ERROR_TYPE_INFO, "Added network %u `%s' %p\n", c, cur->desc, s);
+    LOG (GNUNET_ERROR_TYPE_INFO, "Added network %u `%s' (%llu/%llu)\n",
+        c, cur->desc, cur->total_quota_in, cur->total_quota_out);
   }
   return s;
 }
@@ -1572,12 +1572,12 @@ GAS_proportional_address_add (void *solver, struct ATS_Address *address,
     return;
   }
 
-  aw = GNUNET_malloc (sizeof (struct AddressWrapper));
+  aw = GNUNET_new (struct AddressWrapper);
   aw->addr = address;
   GNUNET_CONTAINER_DLL_insert(net->head, net->tail, aw);
   addresse_increment (s, net, GNUNET_YES, GNUNET_NO);
 
-  asi = GNUNET_malloc (sizeof (struct AddressSolverInformation));
+  asi = GNUNET_new (struct AddressSolverInformation);
   asi->network = net;
   asi->calculated_quota_in_NBO = 0;
   asi->calculated_quota_out_NBO = 0;