aboutsummaryrefslogtreecommitdiff
path: root/src/abd/gnunet-service-abd.c
diff options
context:
space:
mode:
authorMartin Schanzenbach <schanzen@gnunet.org>2022-01-01 09:15:46 +0100
committerMartin Schanzenbach <schanzen@gnunet.org>2022-01-01 09:15:46 +0100
commit2cbb614f694701c4afdab88f58ef7626629e1bc3 (patch)
treec218d78f8284c88361a7e6fc00eacdd22ebfe615 /src/abd/gnunet-service-abd.c
parent9e0d7d411363999bca89f7e7b4e2896b8f6ec931 (diff)
downloadgnunet-2cbb614f694701c4afdab88f58ef7626629e1bc3.tar.gz
gnunet-2cbb614f694701c4afdab88f58ef7626629e1bc3.zip
-coverity
Diffstat (limited to 'src/abd/gnunet-service-abd.c')
-rw-r--r--src/abd/gnunet-service-abd.c44
1 files changed, 24 insertions, 20 deletions
diff --git a/src/abd/gnunet-service-abd.c b/src/abd/gnunet-service-abd.c
index 3f9f2f924..407d5bdc3 100644
--- a/src/abd/gnunet-service-abd.c
+++ b/src/abd/gnunet-service-abd.c
@@ -512,6 +512,8 @@ send_intermediate_response (struct VerifyRequestHandle *vrh, struct
512 size, 512 size,
513 (char *) &rmsg[1])); 513 (char *) &rmsg[1]));
514 GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (vrh->client), env); 514 GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (vrh->client), env);
515
516 GNUNET_free (dd);
515} 517}
516 518
517 519
@@ -740,12 +742,13 @@ forward_resolution (void *cls,
740 uint32_t rd_count, 742 uint32_t rd_count,
741 const struct GNUNET_GNSRECORD_Data *rd) 743 const struct GNUNET_GNSRECORD_Data *rd)
742{ 744{
743 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received %d entries.\n", rd_count);
744
745 struct VerifyRequestHandle *vrh; 745 struct VerifyRequestHandle *vrh;
746 struct DelegationSetQueueEntry *current_set; 746 struct DelegationSetQueueEntry *current_set;
747 struct DelegationSetQueueEntry *ds_entry; 747 struct DelegationSetQueueEntry *ds_entry;
748 struct DelegationQueueEntry *dq_entry; 748 struct DelegationQueueEntry *dq_entry;
749 struct GNUNET_ABD_Delegate *del;
750
751 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received %d entries.\n", rd_count);
749 752
750 current_set = cls; 753 current_set = cls;
751 // set handle to NULL (as el = NULL) 754 // set handle to NULL (as el = NULL)
@@ -760,9 +763,11 @@ forward_resolution (void *cls,
760 continue; 763 continue;
761 764
762 // Start deserialize into Delegate 765 // Start deserialize into Delegate
763 struct GNUNET_ABD_Delegate *del;
764 del = GNUNET_ABD_delegate_deserialize (rd[i].data, rd[i].data_size); 766 del = GNUNET_ABD_delegate_deserialize (rd[i].data, rd[i].data_size);
765 767
768 if (NULL == del)
769 continue;
770
766 // Start: Create DQ Entry 771 // Start: Create DQ Entry
767 dq_entry = GNUNET_new (struct DelegationQueueEntry); 772 dq_entry = GNUNET_new (struct DelegationQueueEntry);
768 // AND delegations are not possible, only 1 solution 773 // AND delegations are not possible, only 1 solution
@@ -834,6 +839,7 @@ forward_resolution (void *cls,
834 GNUNET_IDENTITY_public_key_to_string ( 839 GNUNET_IDENTITY_public_key_to_string (
835 &del->subject_key), 840 &del->subject_key),
836 del->subject_attribute); 841 del->subject_attribute);
842 GNUNET_free (del);
837 continue; 843 continue;
838 } 844 }
839 else 845 else
@@ -910,6 +916,7 @@ forward_resolution (void *cls,
910 } 916 }
911 917
912 send_lookup_response (vrh); 918 send_lookup_response (vrh);
919 GNUNET_free (del);
913 return; 920 return;
914 } 921 }
915 } 922 }
@@ -936,6 +943,7 @@ forward_resolution (void *cls,
936 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 943 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
937 "Forward: Found match with above!\n"); 944 "Forward: Found match with above!\n");
938 945
946 GNUNET_free (del);
939 // one node on the path still needs solutions: return 947 // one node on the path still needs solutions: return
940 if (GNUNET_NO == 948 if (GNUNET_NO ==
941 handle_bidirectional_match (ds_entry, del_entry, vrh)) 949 handle_bidirectional_match (ds_entry, del_entry, vrh))
@@ -965,6 +973,7 @@ forward_resolution (void *cls,
965 GNUNET_GNS_LO_DEFAULT, 973 GNUNET_GNS_LO_DEFAULT,
966 &forward_resolution, 974 &forward_resolution,
967 ds_entry); 975 ds_entry);
976 GNUNET_free (del);
968 } 977 }
969 978
970 if (0 == vrh->pending_lookups) 979 if (0 == vrh->pending_lookups)
@@ -1586,34 +1595,29 @@ handle_delegate_collection_cb (void *cls,
1586 const struct GNUNET_GNSRECORD_Data *rd) 1595 const struct GNUNET_GNSRECORD_Data *rd)
1587{ 1596{
1588 struct VerifyRequestHandle *vrh = cls; 1597 struct VerifyRequestHandle *vrh = cls;
1589 struct GNUNET_ABD_Delegate *del;
1590 struct DelegateRecordEntry *del_entry; 1598 struct DelegateRecordEntry *del_entry;
1591 int cred_record_count;
1592 cred_record_count = 0;
1593 vrh->dele_qe = NULL; 1599 vrh->dele_qe = NULL;
1594 1600
1595 for (uint32_t i = 0; i < rd_count; i++) 1601 for (uint32_t i = 0; i < rd_count; i++)
1596 { 1602 {
1597 if (GNUNET_GNSRECORD_TYPE_DELEGATE != rd[i].record_type) 1603 if (GNUNET_GNSRECORD_TYPE_DELEGATE != rd[i].record_type)
1598 continue; 1604 continue;
1599 cred_record_count++;
1600 del = GNUNET_ABD_delegate_deserialize (rd[i].data, rd[i].data_size);
1601 if (NULL == del)
1602 {
1603 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Invalid delegate found\n");
1604 continue;
1605 }
1606 // only add the entries that are explicitly marked as private 1605 // only add the entries that are explicitly marked as private
1607 // and therefore symbolize the end of a chain 1606 // and therefore symbolize the end of a chain
1608 if (rd[i].flags & GNUNET_GNSRECORD_RF_PRIVATE) 1607 if (0 == (rd[i].flags & GNUNET_GNSRECORD_RF_PRIVATE))
1608 continue;
1609 del_entry = GNUNET_new (struct DelegateRecordEntry);
1610 del_entry->delegate = GNUNET_ABD_delegate_deserialize (rd[i].data, rd[i].data_size);
1611 if (NULL == del_entry->delegate)
1609 { 1612 {
1610 del_entry = GNUNET_new (struct DelegateRecordEntry); 1613 GNUNET_free (del_entry);
1611 del_entry->delegate = del; 1614 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Invalid delegate found\n");
1612 GNUNET_CONTAINER_DLL_insert_tail (vrh->del_chain_head, 1615 continue;
1613 vrh->del_chain_tail,
1614 del_entry);
1615 vrh->del_chain_size++;
1616 } 1616 }
1617 GNUNET_CONTAINER_DLL_insert_tail (vrh->del_chain_head,
1618 vrh->del_chain_tail,
1619 del_entry);
1620 vrh->del_chain_size++;
1617 } 1621 }
1618 1622
1619 delegate_collection_finished (vrh); 1623 delegate_collection_finished (vrh);