diff options
Diffstat (limited to 'src/namestore')
-rw-r--r-- | src/namestore/gnunet-service-namestore.c | 16 | ||||
-rw-r--r-- | src/namestore/namestore_api.c | 6 | ||||
-rw-r--r-- | src/namestore/plugin_rest_namestore.c | 2 |
3 files changed, 22 insertions, 2 deletions
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c index d6774b37b..79210939f 100644 --- a/src/namestore/gnunet-service-namestore.c +++ b/src/namestore/gnunet-service-namestore.c | |||
@@ -743,13 +743,14 @@ send_lookup_response (struct NamestoreClient *nc, | |||
743 | nick->flags = | 743 | nick->flags = |
744 | (nick->flags | GNUNET_GNSRECORD_RF_PRIVATE) ^ GNUNET_GNSRECORD_RF_PRIVATE; | 744 | (nick->flags | GNUNET_GNSRECORD_RF_PRIVATE) ^ GNUNET_GNSRECORD_RF_PRIVATE; |
745 | merge_with_nick_records (nick, rd_count, rd, &res_count, &res); | 745 | merge_with_nick_records (nick, rd_count, rd, &res_count, &res); |
746 | GNUNET_free (nick); | ||
747 | } | 746 | } |
748 | else | 747 | else |
749 | { | 748 | { |
750 | res_count = rd_count; | 749 | res_count = rd_count; |
751 | res = (struct GNUNET_GNSRECORD_Data *) rd; | 750 | res = (struct GNUNET_GNSRECORD_Data *) rd; |
752 | } | 751 | } |
752 | if (NULL != nick) | ||
753 | GNUNET_free (nick); | ||
753 | 754 | ||
754 | GNUNET_assert (-1 != GNUNET_GNSRECORD_records_get_size (res_count, res)); | 755 | GNUNET_assert (-1 != GNUNET_GNSRECORD_records_get_size (res_count, res)); |
755 | 756 | ||
@@ -758,12 +759,16 @@ send_lookup_response (struct NamestoreClient *nc, | |||
758 | rd_ser_len = GNUNET_GNSRECORD_records_get_size (res_count, res); | 759 | rd_ser_len = GNUNET_GNSRECORD_records_get_size (res_count, res); |
759 | if (rd_ser_len < 0) | 760 | if (rd_ser_len < 0) |
760 | { | 761 | { |
762 | if (rd != res) | ||
763 | GNUNET_free (res); | ||
761 | GNUNET_break (0); | 764 | GNUNET_break (0); |
762 | GNUNET_SERVICE_client_drop (nc->client); | 765 | GNUNET_SERVICE_client_drop (nc->client); |
763 | return; | 766 | return; |
764 | } | 767 | } |
765 | if (((size_t) rd_ser_len) >= UINT16_MAX - name_len - sizeof(*zir_msg)) | 768 | if (((size_t) rd_ser_len) >= UINT16_MAX - name_len - sizeof(*zir_msg)) |
766 | { | 769 | { |
770 | if (rd != res) | ||
771 | GNUNET_free (res); | ||
767 | GNUNET_break (0); | 772 | GNUNET_break (0); |
768 | GNUNET_SERVICE_client_drop (nc->client); | 773 | GNUNET_SERVICE_client_drop (nc->client); |
769 | return; | 774 | return; |
@@ -920,12 +925,15 @@ refresh_block (struct NamestoreClient *nc, | |||
920 | nick->flags = | 925 | nick->flags = |
921 | (nick->flags | GNUNET_GNSRECORD_RF_PRIVATE) ^ GNUNET_GNSRECORD_RF_PRIVATE; | 926 | (nick->flags | GNUNET_GNSRECORD_RF_PRIVATE) ^ GNUNET_GNSRECORD_RF_PRIVATE; |
922 | merge_with_nick_records (nick, rd_count, rd, &res_count, &res); | 927 | merge_with_nick_records (nick, rd_count, rd, &res_count, &res); |
923 | GNUNET_free (nick); | ||
924 | } | 928 | } |
929 | if (NULL != nick) | ||
930 | GNUNET_free (nick); | ||
925 | if (0 == res_count) | 931 | if (0 == res_count) |
926 | { | 932 | { |
927 | if (NULL != nc) | 933 | if (NULL != nc) |
928 | send_store_response (nc, GNUNET_OK, rid); | 934 | send_store_response (nc, GNUNET_OK, rid); |
935 | if (rd != res) | ||
936 | GNUNET_free (res); | ||
929 | return; /* no data, no need to update cache */ | 937 | return; /* no data, no need to update cache */ |
930 | } | 938 | } |
931 | if (GNUNET_YES == disable_namecache) | 939 | if (GNUNET_YES == disable_namecache) |
@@ -936,6 +944,8 @@ refresh_block (struct NamestoreClient *nc, | |||
936 | GNUNET_NO); | 944 | GNUNET_NO); |
937 | if (NULL != nc) | 945 | if (NULL != nc) |
938 | send_store_response (nc, GNUNET_OK, rid); | 946 | send_store_response (nc, GNUNET_OK, rid); |
947 | if (rd != res) | ||
948 | GNUNET_free (res); | ||
939 | return; | 949 | return; |
940 | } | 950 | } |
941 | exp_time = GNUNET_GNSRECORD_record_get_expiration_time (res_count, res); | 951 | exp_time = GNUNET_GNSRECORD_record_get_expiration_time (res_count, res); |
@@ -970,6 +980,8 @@ refresh_block (struct NamestoreClient *nc, | |||
970 | &finish_cache_operation, | 980 | &finish_cache_operation, |
971 | cop); | 981 | cop); |
972 | GNUNET_free (block); | 982 | GNUNET_free (block); |
983 | if (rd != res) | ||
984 | GNUNET_free (res); | ||
973 | } | 985 | } |
974 | 986 | ||
975 | 987 | ||
diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c index c845b5019..2d5327e06 100644 --- a/src/namestore/namestore_api.c +++ b/src/namestore/namestore_api.c | |||
@@ -690,6 +690,12 @@ handle_zone_to_name_response (void *cls, | |||
690 | 690 | ||
691 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Received ZONE_TO_NAME_RESPONSE\n"); | 691 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Received ZONE_TO_NAME_RESPONSE\n"); |
692 | qe = find_qe (h, ntohl (msg->gns_header.r_id)); | 692 | qe = find_qe (h, ntohl (msg->gns_header.r_id)); |
693 | if (NULL == qe) | ||
694 | { | ||
695 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
696 | "Response queue already gone...\n"); | ||
697 | return; | ||
698 | } | ||
693 | res = ntohs (msg->res); | 699 | res = ntohs (msg->res); |
694 | switch (res) | 700 | switch (res) |
695 | { | 701 | { |
diff --git a/src/namestore/plugin_rest_namestore.c b/src/namestore/plugin_rest_namestore.c index edcbeb874..ae93e5eff 100644 --- a/src/namestore/plugin_rest_namestore.c +++ b/src/namestore/plugin_rest_namestore.c | |||
@@ -375,6 +375,8 @@ get_egoentry_namestore (struct RequestHandle *handle, char *name) | |||
375 | if (NULL == name) | 375 | if (NULL == name) |
376 | return NULL; | 376 | return NULL; |
377 | tmp = strtok (copy, "/"); | 377 | tmp = strtok (copy, "/"); |
378 | if (NULL == tmp) | ||
379 | return NULL; | ||
378 | for (ego_entry = ego_head; NULL != ego_entry; | 380 | for (ego_entry = ego_head; NULL != ego_entry; |
379 | ego_entry = ego_entry->next) | 381 | ego_entry = ego_entry->next) |
380 | { | 382 | { |