diff options
author | Yang Tse <yangsita@gmail.com> | 2010-02-06 13:21:45 +0000 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2010-02-06 13:21:45 +0000 |
commit | 0f4a91afdedc4b1f7b02f8b015fde1889d80c104 (patch) | |
tree | a3277cf4f8ee0db7523ab4e33b0221faab1a5800 /tests/libtest | |
parent | 2c2464a68211fb788b21de50a51798baa57423be (diff) |
OOM handling fix
Diffstat (limited to 'tests/libtest')
-rw-r--r-- | tests/libtest/lib570.c | 3 | ||||
-rw-r--r-- | tests/libtest/lib571.c | 15 |
2 files changed, 14 insertions, 4 deletions
diff --git a/tests/libtest/lib570.c b/tests/libtest/lib570.c index 4f40a0276..8cfc0b88b 100644 --- a/tests/libtest/lib570.c +++ b/tests/libtest/lib570.c @@ -95,6 +95,9 @@ int test(char *URL) test_cleanup: + if(stream_uri) + free(stream_uri); + curl_easy_cleanup(curl); curl_global_cleanup(); diff --git a/tests/libtest/lib571.c b/tests/libtest/lib571.c index b91a6fa8b..24c507545 100644 --- a/tests/libtest/lib571.c +++ b/tests/libtest/lib571.c @@ -93,7 +93,7 @@ int test(char *URL) CURL *curl; char *stream_uri = NULL; int request=1; - FILE *protofile; + FILE *protofile = NULL; protofile = fopen(libtest_arg2, "wb"); if(protofile == NULL) { @@ -109,8 +109,8 @@ int test(char *URL) if ((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); - curl_global_cleanup(); fclose(protofile); + curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; } test_setopt(curl, CURLOPT_URL, URL); @@ -163,7 +163,10 @@ int test(char *URL) if(res) goto test_cleanup; - stream_uri = suburl(URL, request++); + if((stream_uri = suburl(URL, request++)) == NULL) { + res = TEST_ERR_MAJOR_BAD; + goto test_cleanup; + } test_setopt(curl, CURLOPT_RTSP_STREAM_URI, stream_uri); free(stream_uri); stream_uri = NULL; @@ -184,7 +187,11 @@ int test(char *URL) test_cleanup: - fclose(protofile); + if(stream_uri) + free(stream_uri); + + if(protofile) + fclose(protofile); curl_easy_cleanup(curl); curl_global_cleanup(); |