fixes
authorGabor X Toth <*@tg-x.net>
Mon, 6 Jun 2016 20:00:23 +0000 (20:00 +0000)
committerGabor X Toth <*@tg-x.net>
Mon, 6 Jun 2016 20:00:23 +0000 (20:00 +0000)
src/social/gnunet-service-social.c
src/social/gnunet-social.c
src/social/social_api.c
src/social/test_social.c

index 079f1961c35162ded59cc78c5befc165f7423492..6c57fed3100da4969b313edaf6a06e5ee5c6e508 100644 (file)
@@ -841,7 +841,7 @@ place_recv_relay_method (void *cls,
   struct Place *plc = cls;
 
   if (GNUNET_PSYC_MESSAGE_REQUEST & ntohs (msg->flags)
-      && GNUNET_YES == plc->is_host);
+      && GNUNET_YES == plc->is_host)
   {
     struct Host *hst = cls;
     host_relay_message_part (hst, &meth->header, &msg->slave_pub_key);
@@ -866,7 +866,7 @@ place_recv_relay_modifier (void *cls,
   struct Place *plc = cls;
 
   if (GNUNET_PSYC_MESSAGE_REQUEST & ntohs (msg->flags)
-      && GNUNET_YES == plc->is_host);
+      && GNUNET_YES == plc->is_host)
   {
     struct Host *hst = cls;
     host_relay_message_part (hst, pmsg, &msg->slave_pub_key);
@@ -887,7 +887,7 @@ place_recv_relay_data (void *cls,
   struct Place *plc = cls;
 
   if (GNUNET_PSYC_MESSAGE_REQUEST & ntohs (msg->flags)
-      && GNUNET_YES == plc->is_host);
+      && GNUNET_YES == plc->is_host)
   {
     struct Host *hst = cls;
     host_relay_message_part (hst, pmsg, &msg->slave_pub_key);
@@ -908,7 +908,7 @@ place_recv_relay_eom (void *cls,
   struct Place *plc = cls;
 
   if (GNUNET_PSYC_MESSAGE_REQUEST & ntohs (msg->flags)
-      && GNUNET_YES == plc->is_host);
+      && GNUNET_YES == plc->is_host)
   {
     struct Host *hst = cls;
     host_relay_message_part (hst, pmsg, &msg->slave_pub_key);
@@ -1599,6 +1599,7 @@ guest_enter (const struct GuestEnterRequest *greq, struct Guest **ret_gst)
     uint16_t relay_size = gst->relay_count * sizeof (*relays);
     if (remaining < relay_size)
     {
+      GNUNET_free (gst);
       GNUNET_break (0);
       return GNUNET_SYSERR;
     }
@@ -1858,6 +1859,7 @@ client_recv_guest_enter_by_name (void *cls, struct GNUNET_SERVER_Client *client,
   {
     if (NULL != gcls->join_msg)
       GNUNET_free (gcls->join_msg);
+    GNUNET_free (gcls);
     GNUNET_break (0);
     GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
     return;
@@ -2895,6 +2897,8 @@ psyc_recv_history_message (void *cls, const struct GNUNET_PSYC_MessageHeader *ms
 
   /** @todo FIXME: send only to requesting client */
   place_send_msg (plc, &res->header);
+
+  GNUNET_free (res);
 }
 
 
@@ -3001,6 +3005,8 @@ psyc_recv_state_var (void *cls,
 
   /** @todo FIXME: send only to requesting client */
   place_send_msg (plc, &res->header);
+
+  GNUNET_free (res);
 }
 
 
@@ -3304,10 +3310,14 @@ file_place_load (void *cls, const char *place_filename)
   if (GNUNET_OK !=
       GNUNET_DISK_file_size (filename, &file_size, GNUNET_YES, GNUNET_YES)
       || file_size < sizeof (struct PlaceEnterRequest))
+  {
+    GNUNET_free (filename);
     return GNUNET_OK;
+  }
 
   struct PlaceEnterRequest *ereq = GNUNET_malloc (file_size);
   ssize_t read_size = GNUNET_DISK_fn_read (filename, ereq, file_size);
+  GNUNET_free (filename);
   if (read_size < 0 || read_size < sizeof (*ereq))
   {
     GNUNET_free (ereq);
index b7a1314c224dd9ab6d7bb82f1a0104e185f92d14..a6ea772e762bf830f8e24743bffd91856e0eed98 100644 (file)
@@ -1148,9 +1148,10 @@ run (void *cls, char *const *args, const char *cfgfile,
 
   if (opt_ego)
   {
-    GNUNET_CRYPTO_ecdsa_public_key_from_string (opt_ego,
-                                                strlen (opt_ego),
-                                                &ego_pub_key);
+    GNUNET_assert (GNUNET_OK ==
+                   GNUNET_CRYPTO_ecdsa_public_key_from_string (opt_ego,
+                                                               strlen (opt_ego),
+                                                               &ego_pub_key));
   }
 
   core = GNUNET_CORE_connect (cfg, NULL, &core_connected, NULL, NULL,
index e590f7856b8a169948225e0f66bd918c34fc442b..3a57af5dd8c249c7a541ad3dfaaed6637386fa23 100644 (file)
@@ -411,6 +411,7 @@ host_recv_notice_place_leave_method (void *cls,
   GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
               "_notice_place_leave: got method from nym %s (%s).\n",
               GNUNET_h2s (&hst->notice_place_leave_nym->pub_key_hash), str);
+  GNUNET_free (str);
 }
 
 
@@ -459,6 +460,7 @@ host_recv_notice_place_leave_eom (void *cls,
   GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
               "_notice_place_leave: got EOM from nym %s (%s).\n",
               GNUNET_h2s (&hst->notice_place_leave_nym->pub_key_hash), str);
+  GNUNET_free (str);
 
   if (GNUNET_YES != is_cancelled)
   {
@@ -1355,14 +1357,17 @@ GNUNET_SOCIAL_host_entry_decision (struct GNUNET_SOCIAL_Host *hst,
 void
 GNUNET_SOCIAL_host_eject (struct GNUNET_SOCIAL_Host *hst,
                           const struct GNUNET_SOCIAL_Nym *nym,
-                          struct GNUNET_PSYC_Environment *env)
+                          struct GNUNET_PSYC_Environment *e)
 {
+  struct GNUNET_PSYC_Environment *env = e;
   if (NULL == env)
     env = GNUNET_PSYC_env_create ();
   GNUNET_PSYC_env_add (env, GNUNET_PSYC_OP_SET,
                        "_nym", &nym->pub_key, sizeof (nym->pub_key));
   GNUNET_SOCIAL_host_announce (hst, "_notice_place_leave", env, NULL, NULL,
                                GNUNET_SOCIAL_ANNOUNCE_NONE);
+  if (NULL == e)
+    GNUNET_PSYC_env_destroy (env);
 }
 
 
@@ -1749,7 +1754,7 @@ GNUNET_SOCIAL_guest_enter_by_name (const struct GNUNET_SOCIAL_App *app,
   uint16_t password_size = strlen (password) + 1;
 
   uint16_t join_msg_size = 0;
-  if (NULL != join_msg);
+  if (NULL != join_msg)
     join_msg_size = ntohs (join_msg->header.size);
 
   uint16_t greq_size = sizeof (struct GuestEnterByNameRequest)
index 14bcac7a166bfa3882bae83da475d13b39a020e3..dd38a2920499acb9673c87d71988137b9f916817 100644 (file)
@@ -463,10 +463,11 @@ app_recv_ego (void *cls,
               const struct GNUNET_CRYPTO_EcdsaPublicKey *ego_pub_key,
               const char *name)
 {
+  char *ego_pub_str = GNUNET_CRYPTO_ecdsa_public_key_to_string (ego_pub_key);
   GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
               "Got app ego notification: %p %s %s\n",
-              ego, name,
-              GNUNET_CRYPTO_ecdsa_public_key_to_string (ego_pub_key));
+              ego, name, ego_pub_str);
+  GNUNET_free (ego_pub_str);
 
   if (NULL != strstr (name, host_name) && TEST_HOST_CREATE == test)
   {
@@ -1097,6 +1098,8 @@ host_answer_door (void *cls,
 
   case TEST_HOST_ANSWER_DOOR_ADMIT:
     test = TEST_GUEST_RECV_ENTRY_DCSN_ADMIT;
+    // fall through
+
   case TEST_GUEST_ENTER_BY_NAME:
     join_resp = GNUNET_PSYC_message_create ("_notice_place_admit", env,
                                             DATA2ARG ("Welcome, nym!"));