diff options
author | Dan Fandrich <dan@coneharvesters.com> | 2014-09-26 06:41:23 +0200 |
---|---|---|
committer | Dan Fandrich <dan@coneharvesters.com> | 2014-09-26 06:57:52 +0200 |
commit | 46d71e7fd298f8c5d23034a88e856b254ff64253 (patch) | |
tree | bc4fd2d2df5dc82c20002fb99514e9b231a858d0 | |
parent | b10a838a7add072b88ab87c203361d655caa077b (diff) |
test506: Fixed a couple of memory leaks in test
-rw-r--r-- | tests/libtest/lib506.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/tests/libtest/lib506.c b/tests/libtest/lib506.c index 9bb4ff27e..2fbe38fe9 100644 --- a/tests/libtest/lib506.c +++ b/tests/libtest/lib506.c @@ -182,6 +182,7 @@ int test(char *URL) CURLSH *share; struct curl_slist *headers = NULL; struct curl_slist *cookies = NULL; + struct curl_slist *next_cookie = NULL; int i; struct userdata user; @@ -300,6 +301,8 @@ int test(char *URL) printf( "CLEANUP\n" ); curl_easy_cleanup( curl ); + curl_free(url); + curl_slist_free_all( headers ); /* load cookies */ if ((curl = curl_easy_init()) == NULL) { @@ -338,10 +341,11 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } printf("-----------------\n"); - while ( cookies ) + next_cookie = cookies; + while ( next_cookie ) { - printf( " %s\n", cookies->data ); - cookies = cookies->next; + printf( " %s\n", next_cookie->data ); + next_cookie = next_cookie->next; } printf("-----------------\n"); curl_slist_free_all( cookies ); @@ -362,12 +366,8 @@ test_cleanup: /* clean up last handle */ printf( "CLEANUP\n" ); curl_easy_cleanup( curl ); - - if ( headers ) - curl_slist_free_all( headers ); - - if ( url ) - curl_free(url); + curl_slist_free_all( headers ); + curl_free(url); /* free share */ printf( "SHARE_CLEANUP\n" ); |