From 49033aed99b605ba358ab67f9a8e25f117bdb93d Mon Sep 17 00:00:00 2001 From: Gabor X Toth <*@tg-x.net> Date: Mon, 6 Jun 2016 20:31:03 +0000 Subject: [PATCH] fixes --- src/multicast/gnunet-service-multicast.c | 4 +++- src/multicast/multicast_api.c | 3 ++- src/psyc/gnunet-service-psyc.c | 8 ++++++-- src/psyc/psyc_api.c | 8 +++++++- src/psycutil/psyc_slicer.c | 1 + 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/multicast/gnunet-service-multicast.c b/src/multicast/gnunet-service-multicast.c index f157041bc..94f9d2f88 100644 --- a/src/multicast/gnunet-service-multicast.c +++ b/src/multicast/gnunet-service-multicast.c @@ -447,6 +447,7 @@ replay_req_remove_cadet (struct Channel *chn) if (c == chn) { GNUNET_CONTAINER_multihashmap_remove (grp_replay_req, &key, chn); + GNUNET_CONTAINER_multihashmap_iterator_destroy (it); return GNUNET_YES; } } @@ -484,6 +485,7 @@ replay_req_remove_client (struct Group *grp, struct GNUNET_SERVER_Client *client if (c == client) { GNUNET_CONTAINER_multihashmap_remove (replay_req_client, &key, client); + GNUNET_CONTAINER_multihashmap_iterator_destroy (it); return GNUNET_YES; } } @@ -759,7 +761,7 @@ cadet_send_channel (struct Channel *chn, const struct GNUNET_MessageHeader *msg) GNUNET_TIME_UNIT_FOREVER_REL, ntohs (msg->size), &cadet_notify_transmit_ready, - (void *) msg); + tcls); GNUNET_assert (NULL != chn->tmit_handle); } diff --git a/src/multicast/multicast_api.c b/src/multicast/multicast_api.c index 09e7a8d42..ce36ef6f2 100644 --- a/src/multicast/multicast_api.c +++ b/src/multicast/multicast_api.c @@ -204,9 +204,10 @@ static void group_send_connect_msg (struct GNUNET_MULTICAST_Group *grp) { uint16_t cmsg_size = ntohs (grp->connect_msg->size); - struct GNUNET_MessageHeader * cmsg = GNUNET_malloc (cmsg_size); + struct GNUNET_MessageHeader *cmsg = GNUNET_malloc (cmsg_size); memcpy (cmsg, grp->connect_msg, cmsg_size); GNUNET_CLIENT_MANAGER_transmit_now (grp->client, cmsg); + GNUNET_free (cmsg); } diff --git a/src/psyc/gnunet-service-psyc.c b/src/psyc/gnunet-service-psyc.c index dc5697a07..8fd2fbf35 100644 --- a/src/psyc/gnunet-service-psyc.c +++ b/src/psyc/gnunet-service-psyc.c @@ -866,7 +866,7 @@ store_recv_fragment_replay_result (void *cls, int64_t result, case GNUNET_SYSERR: GNUNET_MULTICAST_replay_response (rh, NULL, GNUNET_MULTICAST_REC_INTERNAL_ERROR); - break; + return; } GNUNET_MULTICAST_replay_response_end (rh); } @@ -2006,7 +2006,6 @@ transmit_notify (void *cls, size_t *data_size, void *data) send_message_ack (chn, tmit_msg->client); GNUNET_CONTAINER_DLL_remove (chn->tmit_head, chn->tmit_tail, tmit_msg); - GNUNET_free (tmit_msg); if (NULL != chn->tmit_head) { @@ -2016,8 +2015,10 @@ transmit_notify (void *cls, size_t *data_size, void *data) && tmit_msg->last_ptype < GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_END) { /* FIXME: handle partial message (when still in_transmit) */ + GNUNET_free (tmit_msg); return GNUNET_SYSERR; } + GNUNET_free (tmit_msg); return ret; } @@ -2393,6 +2394,8 @@ store_recv_fragment_history (void *cls, /** @todo FIXME: send only to requesting client */ client_send_msg (chn, &res->header); + + GNUNET_free (res); return GNUNET_YES; } @@ -2528,6 +2531,7 @@ store_recv_state_var (void *cls, const char *name, GNUNET_SERVER_notification_context_add (nc, op->client); GNUNET_SERVER_notification_context_unicast (nc, op->client, &res->header, GNUNET_NO); + GNUNET_free (res); return GNUNET_YES; } diff --git a/src/psyc/psyc_api.c b/src/psyc/psyc_api.c index 018eb63ad..441c74a08 100644 --- a/src/psyc/psyc_api.c +++ b/src/psyc/psyc_api.c @@ -223,9 +223,10 @@ static void channel_send_connect_msg (struct GNUNET_PSYC_Channel *chn) { uint16_t cmsg_size = ntohs (chn->connect_msg->size); - struct GNUNET_MessageHeader * cmsg = GNUNET_malloc (cmsg_size); + struct GNUNET_MessageHeader *cmsg = GNUNET_malloc (cmsg_size); memcpy (cmsg, chn->connect_msg, cmsg_size); GNUNET_CLIENT_MANAGER_transmit_now (chn->client, cmsg); + GNUNET_free (cmsg); } @@ -762,6 +763,7 @@ GNUNET_PSYC_join_decision (struct GNUNET_PSYC_JoinHandle *jh, memcpy (&dcsn[1], join_resp, join_resp_size); GNUNET_CLIENT_MANAGER_transmit (chn->client, &dcsn->header); + GNUNET_free (dcsn); GNUNET_free (jh); return GNUNET_OK; } @@ -1078,6 +1080,7 @@ GNUNET_PSYC_channel_slave_add (struct GNUNET_PSYC_Channel *chn, result_cb, cls)); GNUNET_CLIENT_MANAGER_transmit (chn->client, &req->header); + GNUNET_free (req); } @@ -1129,6 +1132,7 @@ GNUNET_PSYC_channel_slave_remove (struct GNUNET_PSYC_Channel *chn, result_cb, cls)); GNUNET_CLIENT_MANAGER_transmit (chn->client, &req->header); + GNUNET_free (req); } @@ -1169,6 +1173,7 @@ channel_history_replay (struct GNUNET_PSYC_Channel *chn, memcpy (&req[1], method_prefix, method_size); GNUNET_CLIENT_MANAGER_transmit (chn->client, &req->header); + GNUNET_free (req); return hist; } @@ -1309,6 +1314,7 @@ channel_state_get (struct GNUNET_PSYC_Channel *chn, memcpy (&req[1], name, name_size); GNUNET_CLIENT_MANAGER_transmit (chn->client, &req->header); + GNUNET_free (req); return sr; } diff --git a/src/psycutil/psyc_slicer.c b/src/psycutil/psyc_slicer.c index a9c96ff04..b641d9721 100644 --- a/src/psycutil/psyc_slicer.c +++ b/src/psycutil/psyc_slicer.c @@ -341,6 +341,7 @@ GNUNET_PSYC_slicer_message_part (struct GNUNET_PSYC_Slicer *slicer, slicer->mod_value_remaining = slicer->mod_full_value_size; slicer->mod_value_size = ntohs (mod->header.size) - sizeof (*mod) - slicer->mod_name_size; + // fall through } case GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_MOD_CONT: if (ptype == GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_MOD_CONT) -- 2.25.1