diff options
Diffstat (limited to 'src/namestore/gnunet-service-namestore.c')
-rw-r--r-- | src/namestore/gnunet-service-namestore.c | 16 |
1 files changed, 14 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 | ||