From 7a18ac7454f16a2ac592312e041f9bb9f30cae31 Mon Sep 17 00:00:00 2001 From: Yawning Angel Date: Mon, 14 Apr 2014 21:51:34 +0000 Subject: [PATCH] Fixed the test build with --enable-gcc-warnings --- src/test/test_pt.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/test/test_pt.c b/src/test/test_pt.c index 788d4205cc..cfbd084226 100644 --- a/src/test/test_pt.c +++ b/src/test/test_pt.c @@ -464,7 +464,7 @@ test_get_pt_proxy_uri(void *arg) tt_assert(uri == NULL); /* Test with a SOCKS4 proxy. */ - options->Socks4Proxy = "192.0.2.1:1080"; + options->Socks4Proxy = tor_strdup("192.0.2.1:1080"); ret = tor_addr_port_lookup(options->Socks4Proxy, &options->Socks4ProxyAddr, &options->Socks4ProxyPort); @@ -472,11 +472,10 @@ test_get_pt_proxy_uri(void *arg) uri = get_pt_proxy_uri(); tt_str_op(uri, ==, "socks4a://192.0.2.1:1080"); tor_free(uri); - - options->Socks4Proxy = NULL; + tor_free(options->Socks4Proxy); /* Test with a SOCKS5 proxy, no username/password. */ - options->Socks5Proxy = "192.0.2.1:1080"; + options->Socks5Proxy = tor_strdup("192.0.2.1:1080"); ret = tor_addr_port_lookup(options->Socks5Proxy, &options->Socks5ProxyAddr, &options->Socks5ProxyPort); @@ -486,16 +485,17 @@ test_get_pt_proxy_uri(void *arg) tor_free(uri); /* Test with a SOCKS5 proxy, with username/password. */ - options->Socks5ProxyUsername = "hwest"; - options->Socks5ProxyPassword = "r34n1m470r"; + options->Socks5ProxyUsername = tor_strdup("hwest"); + options->Socks5ProxyPassword = tor_strdup("r34n1m470r"); uri = get_pt_proxy_uri(); tt_str_op(uri, ==, "socks5://hwest:r34n1m470r@192.0.2.1:1080"); tor_free(uri); - - options->Socks5Proxy = NULL; + tor_free(options->Socks5Proxy); + tor_free(options->Socks5ProxyUsername); + tor_free(options->Socks5ProxyPassword); /* Test with a HTTPS proxy, no authenticator. */ - options->HTTPSProxy = "192.0.2.1:80"; + options->HTTPSProxy = tor_strdup("192.0.2.1:80"); ret = tor_addr_port_lookup(options->HTTPSProxy, &options->HTTPSProxyAddr, &options->HTTPSProxyPort); @@ -505,15 +505,15 @@ test_get_pt_proxy_uri(void *arg) tor_free(uri); /* Test with a HTTPS proxy, with authenticator. */ - options->HTTPSProxyAuthenticator = "hwest:r34n1m470r"; + options->HTTPSProxyAuthenticator = tor_strdup("hwest:r34n1m470r"); uri = get_pt_proxy_uri(); tt_str_op(uri, ==, "http://hwest:r34n1m470r@192.0.2.1:80"); tor_free(uri); - - options->HTTPSProxy = NULL; + tor_free(options->HTTPSProxy); + tor_free(options->HTTPSProxyAuthenticator); /* Token nod to the fact that IPv6 exists. */ - options->Socks4Proxy = "[2001:db8::1]:1080"; + options->Socks4Proxy = tor_strdup("[2001:db8::1]:1080"); ret = tor_addr_port_lookup(options->Socks4Proxy, &options->Socks4ProxyAddr, &options->Socks4ProxyPort); @@ -521,7 +521,7 @@ test_get_pt_proxy_uri(void *arg) uri = get_pt_proxy_uri(); tt_str_op(uri, ==, "socks4a://[2001:db8::1]:1080"); tor_free(uri); - + tor_free(options->Socks4Proxy); done: if (uri)