X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=tests%2Funit%2Funit1305.c;h=91e3b0b27ff3d934530f0c80812814ab87bc93c0;hb=7b6dca47a42828c0ae87eab0d8b68f97d1495b67;hp=96913f1fa421c07425514f6c9327f0edfb7dfad0;hpb=8a08705db260779441360e959b97b6c172f8acb0;p=platform%2Fupstream%2Fcurl.git diff --git a/tests/unit/unit1305.c b/tests/unit/unit1305.c index 96913f1..91e3b0b 100644 --- a/tests/unit/unit1305.c +++ b/tests/unit/unit1305.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2015, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -40,19 +40,18 @@ #include "memdebug.h" /* LAST include file */ static struct SessionHandle *data; -static struct curl_hash hp; +static struct curl_hash *hp; static char *data_key; static struct Curl_dns_entry *data_node; static CURLcode unit_setup( void ) { - int rc; data = curl_easy_init(); if (!data) return CURLE_OUT_OF_MEMORY; - rc = Curl_mk_dnscache(&hp); - if(rc) { + hp = Curl_mk_dnscache(); + if(!hp) { curl_easy_cleanup(data); curl_global_cleanup(); return CURLE_OUT_OF_MEMORY; @@ -66,8 +65,10 @@ static void unit_stop( void ) Curl_freeaddrinfo(data_node->addr); free(data_node); } - free(data_key); - Curl_hash_destroy(&hp); + if (data_key) + free(data_key); + + Curl_hash_destroy(hp); curl_easy_cleanup(data); curl_global_cleanup(); @@ -129,8 +130,7 @@ UNITTEST_START abort_unless(rc == CURLE_OK, "data node creation failed"); key_len = strlen(data_key); - data_node->inuse = 1; /* hash will hold the reference */ - nodep = Curl_hash_add(&hp, data_key, key_len+1, data_node); + nodep = Curl_hash_add(hp, data_key, key_len+1, data_node); abort_unless(nodep, "insertion into hash failed"); /* Freeing will now be done by Curl_hash_destroy */ data_node = NULL;