diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-06-01 21:05:24 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-06-01 21:05:24 +0000 |
commit | 2a6488eb1ed561f5f32d8465057893123f3a6703 (patch) | |
tree | 9351256c045a6ae1f9fdec8f895e79a7c4278cce /src | |
parent | 98ab487a1068783839b864e066567da9cf9e4aa1 (diff) | |
download | gnunet-2a6488eb1ed561f5f32d8465057893123f3a6703.tar.gz gnunet-2a6488eb1ed561f5f32d8465057893123f3a6703.zip |
fixing memory leak
Diffstat (limited to 'src')
-rw-r--r-- | src/transport/test_plugin_transport_http.c | 50 |
1 files changed, 24 insertions, 26 deletions
diff --git a/src/transport/test_plugin_transport_http.c b/src/transport/test_plugin_transport_http.c index 9354cad70..b28750443 100644 --- a/src/transport/test_plugin_transport_http.c +++ b/src/transport/test_plugin_transport_http.c | |||
@@ -609,26 +609,25 @@ notify_address (void *cls, | |||
609 | uint16_t addrlen, | 609 | uint16_t addrlen, |
610 | struct GNUNET_TIME_Relative expires) | 610 | struct GNUNET_TIME_Relative expires) |
611 | { | 611 | { |
612 | char * address = NULL; | 612 | char address[INET6_ADDRSTRLEN]; |
613 | unsigned int port; | 613 | unsigned int port; |
614 | struct Plugin_Address * pl_addr; | 614 | struct Plugin_Address * pl_addr; |
615 | struct Plugin_Address * cur; | 615 | struct Plugin_Address * cur; |
616 | 616 | ||
617 | if (addrlen == (sizeof (struct IPv4HttpAddress))) | 617 | if (addrlen == (sizeof (struct IPv4HttpAddress))) |
618 | { | 618 | { |
619 | address = GNUNET_malloc (INET_ADDRSTRLEN); | 619 | inet_ntop(AF_INET, (struct in_addr *) addr,address,INET_ADDRSTRLEN); |
620 | inet_ntop(AF_INET, (struct in_addr *) addr,address,INET_ADDRSTRLEN); | 620 | port = ntohs(((struct IPv4HttpAddress *) addr)->u_port); |
621 | port = ntohs(((struct IPv4HttpAddress *) addr)->u_port); | 621 | } |
622 | } | ||
623 | |||
624 | if (addrlen == (sizeof (struct IPv6HttpAddress))) | 622 | if (addrlen == (sizeof (struct IPv6HttpAddress))) |
625 | { | 623 | { |
626 | address = GNUNET_malloc (INET6_ADDRSTRLEN); | 624 | inet_ntop(AF_INET6, (struct in6_addr *) addr,address,INET6_ADDRSTRLEN); |
627 | inet_ntop(AF_INET6, (struct in6_addr *) addr,address,INET6_ADDRSTRLEN); | 625 | port = ntohs(((struct IPv6HttpAddress *) addr)->u6_port); |
628 | port = ntohs(((struct IPv6HttpAddress *) addr)->u6_port); | 626 | } |
629 | } | 627 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
630 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Transport plugin notification for address: `%s':%u\n"),address,port); | 628 | _("Transport plugin notification for address: `%s':%u\n"), |
631 | 629 | address, | |
630 | port); | ||
632 | pl_addr = GNUNET_malloc (sizeof (struct Plugin_Address) ); | 631 | pl_addr = GNUNET_malloc (sizeof (struct Plugin_Address) ); |
633 | pl_addr->addrlen = addrlen; | 632 | pl_addr->addrlen = addrlen; |
634 | pl_addr->addr = GNUNET_malloc(addrlen); | 633 | pl_addr->addr = GNUNET_malloc(addrlen); |
@@ -636,19 +635,18 @@ notify_address (void *cls, | |||
636 | pl_addr->next = NULL; | 635 | pl_addr->next = NULL; |
637 | 636 | ||
638 | if ( NULL == addr_head) | 637 | if ( NULL == addr_head) |
639 | { | 638 | { |
640 | addr_head = pl_addr; | 639 | addr_head = pl_addr; |
641 | } | 640 | } |
642 | else | 641 | else |
643 | { | 642 | { |
644 | cur = addr_head; | 643 | cur = addr_head; |
645 | while (NULL != cur->next) | 644 | while (NULL != cur->next) |
646 | { | 645 | { |
647 | cur = cur->next; | 646 | cur = cur->next; |
648 | } | 647 | } |
649 | cur->next = pl_addr; | 648 | cur->next = pl_addr; |
650 | } | 649 | } |
651 | |||
652 | fail_notify_address_count++; | 650 | fail_notify_address_count++; |
653 | fail_notify_address = GNUNET_NO; | 651 | fail_notify_address = GNUNET_NO; |
654 | } | 652 | } |