social: crashing free() removed.. was it redundant?
[oweals/gnunet.git] / src / social / social_api.c
index c33f39dceab8ad932eb5203d6763e13b3ae79efc..f7b536bcfb387a49a2e2f44919ade24a2241d57c 100644 (file)
@@ -967,19 +967,21 @@ app_recv_place (void *cls,
 
   if (GNUNET_YES == pmsg->is_host)
   {
-    struct GNUNET_SOCIAL_HostConnection *hconn = GNUNET_malloc (sizeof (*hconn));
-    hconn->app = app;
-    hconn->plc_msg = *pmsg;
-    if (NULL != app->host_cb)
+    if (NULL != app->host_cb) {
+      struct GNUNET_SOCIAL_HostConnection *hconn = GNUNET_malloc (sizeof (*hconn));
+      hconn->app = app;
+      hconn->plc_msg = *pmsg;
       app->host_cb (app->cb_cls, hconn, ego, &pmsg->place_pub_key, pmsg->place_state);
+      // FIXME: should this have a GNUNET_free (hconn) here?
+    }
   }
-  else
+  else if (NULL != app->guest_cb)
   {
     struct GNUNET_SOCIAL_GuestConnection *gconn = GNUNET_malloc (sizeof (*gconn));
     gconn->app = app;
     gconn->plc_msg = *pmsg;
-    if (NULL != app->guest_cb)
-      app->guest_cb (app->cb_cls, gconn, ego, &pmsg->place_pub_key, pmsg->place_state);
+    app->guest_cb (app->cb_cls, gconn, ego, &pmsg->place_pub_key, pmsg->place_state);
+    // GNUNET_free (gconn); // FIXME: is this correct here? apparently not!
   }
 }
 
@@ -1155,9 +1157,6 @@ guest_cleanup (void *cls)
  *        Application handle.
  * @param ego
  *        Identity of the host.
- * @param place_key
- *        Private-public key pair of the place.
- *        NULL to generate a key.
  * @param policy
  *        Policy specifying entry and history restrictions for the place.
  * @param slicer
@@ -1171,7 +1170,7 @@ guest_cleanup (void *cls)
  * @param cls
  *        Closure for the callbacks.
  *
- * @return Handle for the host.
+ * @return Handle for the host. This handle contains the pubkey.
  */
 struct GNUNET_SOCIAL_Host *
 GNUNET_SOCIAL_host_enter (const struct GNUNET_SOCIAL_App *app,