diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2012-03-15 12:53:04 +0000 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2012-03-15 12:53:04 +0000 |
commit | 38e3d5333fed59e0c6fdd9eab1769b546370276a (patch) | |
tree | 9d7200de993cc634d792d3b7dc58fc229e2add7a /src | |
parent | d9e8e70828e22f1a7f43825e460d5817d9e6e21b (diff) | |
download | gnunet-38e3d5333fed59e0c6fdd9eab1769b546370276a.tar.gz gnunet-38e3d5333fed59e0c6fdd9eab1769b546370276a.zip |
-fix leaks
Diffstat (limited to 'src')
-rw-r--r-- | src/gns/gnunet-service-gns_resolver.c | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c index 2fb0ce6ab..3a94556b7 100644 --- a/src/gns/gnunet-service-gns_resolver.c +++ b/src/gns/gnunet-service-gns_resolver.c | |||
@@ -629,6 +629,9 @@ handle_record_dht(void* cls, struct ResolverHandle *rh, | |||
629 | rh->name); | 629 | rh->name); |
630 | /* give up, cannot resolve */ | 630 | /* give up, cannot resolve */ |
631 | rlh->proc(rlh->proc_cls, 0, NULL); | 631 | rlh->proc(rlh->proc_cls, 0, NULL); |
632 | GNUNET_free(rlh->name); | ||
633 | GNUNET_free(rlh); | ||
634 | free_resolver_handle(rh); | ||
632 | return; | 635 | return; |
633 | } | 636 | } |
634 | 637 | ||
@@ -636,6 +639,9 @@ handle_record_dht(void* cls, struct ResolverHandle *rh, | |||
636 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 639 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
637 | "Record resolved from DHT!"); | 640 | "Record resolved from DHT!"); |
638 | rlh->proc(rlh->proc_cls, rd_count, rd); | 641 | rlh->proc(rlh->proc_cls, rd_count, rd); |
642 | GNUNET_free(rlh->name); | ||
643 | GNUNET_free(rlh); | ||
644 | free_resolver_handle(rh); | ||
639 | 645 | ||
640 | } | 646 | } |
641 | 647 | ||
@@ -668,6 +674,9 @@ handle_record_ns(void* cls, struct ResolverHandle *rh, | |||
668 | } | 674 | } |
669 | /* give up, cannot resolve */ | 675 | /* give up, cannot resolve */ |
670 | rlh->proc(rlh->proc_cls, 0, NULL); | 676 | rlh->proc(rlh->proc_cls, 0, NULL); |
677 | GNUNET_free(rlh->name); | ||
678 | GNUNET_free(rlh); | ||
679 | free_resolver_handle(rh); | ||
671 | return; | 680 | return; |
672 | } | 681 | } |
673 | 682 | ||
@@ -675,6 +684,9 @@ handle_record_ns(void* cls, struct ResolverHandle *rh, | |||
675 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 684 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
676 | "Record resolved from namestore!"); | 685 | "Record resolved from namestore!"); |
677 | rlh->proc(rlh->proc_cls, rd_count, rd); | 686 | rlh->proc(rlh->proc_cls, rd_count, rd); |
687 | GNUNET_free(rlh->name); | ||
688 | GNUNET_free(rlh); | ||
689 | free_resolver_handle(rh); | ||
678 | 690 | ||
679 | } | 691 | } |
680 | 692 | ||
@@ -778,6 +790,9 @@ handle_delegation_dht(void* cls, struct ResolverHandle *rh, | |||
778 | "Cannot fully resolve delegation for %s via DHT!\n", | 790 | "Cannot fully resolve delegation for %s via DHT!\n", |
779 | rh->name); | 791 | rh->name); |
780 | rlh->proc(rlh->proc_cls, 0, NULL); | 792 | rlh->proc(rlh->proc_cls, 0, NULL); |
793 | GNUNET_free(rlh->name); | ||
794 | GNUNET_free(rlh); | ||
795 | free_resolver_handle(rh); | ||
781 | } | 796 | } |
782 | 797 | ||
783 | 798 | ||
@@ -1099,7 +1114,9 @@ gns_resolver_lookup_record(GNUNET_HashCode zone, | |||
1099 | rh->authority_chain_head->zone = zone; | 1114 | rh->authority_chain_head->zone = zone; |
1100 | 1115 | ||
1101 | rlh->record_type = record_type; | 1116 | rlh->record_type = record_type; |
1102 | rlh->name = (char*)name; //FIXME | 1117 | rlh->name = GNUNET_malloc(strlen(name) + 1); |
1118 | memset(rlh->name, 0, strlen(name) + 1); | ||
1119 | strcpy(rlh->name, name); //FIXME | ||
1103 | rlh->proc = proc; | 1120 | rlh->proc = proc; |
1104 | rlh->proc_cls = cls; | 1121 | rlh->proc_cls = cls; |
1105 | 1122 | ||
@@ -1157,6 +1174,7 @@ process_zone_to_name_shorten(void *cls, | |||
1157 | "Sending shorten result %s\n", result); | 1174 | "Sending shorten result %s\n", result); |
1158 | 1175 | ||
1159 | nsh->proc(nsh->proc_cls, result); | 1176 | nsh->proc(nsh->proc_cls, result); |
1177 | GNUNET_free(nsh); | ||
1160 | free_resolver_handle(rh); | 1178 | free_resolver_handle(rh); |
1161 | GNUNET_free(result); | 1179 | GNUNET_free(result); |
1162 | } | 1180 | } |
@@ -1175,6 +1193,7 @@ process_zone_to_name_shorten(void *cls, | |||
1175 | "Our zone: Sending name as shorten result %s\n", rh->name); | 1193 | "Our zone: Sending name as shorten result %s\n", rh->name); |
1176 | 1194 | ||
1177 | nsh->proc(nsh->proc_cls, result); | 1195 | nsh->proc(nsh->proc_cls, result); |
1196 | GNUNET_free(nsh); | ||
1178 | free_resolver_handle(rh); | 1197 | free_resolver_handle(rh); |
1179 | GNUNET_free(result); | 1198 | GNUNET_free(result); |
1180 | } | 1199 | } |
@@ -1259,6 +1278,7 @@ handle_delegation_ns_shorten(void* cls, | |||
1259 | "Our zone: Sending name as shorten result %s\n", rh->name); | 1278 | "Our zone: Sending name as shorten result %s\n", rh->name); |
1260 | 1279 | ||
1261 | nsh->proc(nsh->proc_cls, result); | 1280 | nsh->proc(nsh->proc_cls, result); |
1281 | GNUNET_free(nsh); | ||
1262 | free_resolver_handle(rh); | 1282 | free_resolver_handle(rh); |
1263 | GNUNET_free(result); | 1283 | GNUNET_free(result); |
1264 | return; | 1284 | return; |
@@ -1378,17 +1398,19 @@ handle_delegation_result_ns_get_auth(void* cls, | |||
1378 | "Got authority result %s\n", result); | 1398 | "Got authority result %s\n", result); |
1379 | 1399 | ||
1380 | nah->proc(nah->proc_cls, result); | 1400 | nah->proc(nah->proc_cls, result); |
1401 | GNUNET_free(nah->name); | ||
1402 | GNUNET_free(nah); | ||
1381 | free_resolver_handle(rh); | 1403 | free_resolver_handle(rh); |
1382 | GNUNET_free(result); | 1404 | GNUNET_free(result); |
1383 | GNUNET_free(nah); | ||
1384 | } | 1405 | } |
1385 | else | 1406 | else |
1386 | { | 1407 | { |
1387 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1408 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1388 | "Unable to resolve authority for remaining %s!\n", rh->name); | 1409 | "Unable to resolve authority for remaining %s!\n", rh->name); |
1389 | nah->proc(nah->proc_cls, ""); | 1410 | nah->proc(nah->proc_cls, ""); |
1390 | free_resolver_handle(rh); | 1411 | GNUNET_free(nah->name); |
1391 | GNUNET_free(nah); | 1412 | GNUNET_free(nah); |
1413 | free_resolver_handle(rh); | ||
1392 | } | 1414 | } |
1393 | 1415 | ||
1394 | 1416 | ||