You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2016/06/28 16:50:39 UTC

[trafficserver] branch master updated: TS-4518 Eliminate memory leaks in UUID regressions

This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

The following commit(s) were added to refs/heads/master by this push:
       new  8652504   TS-4518 Eliminate memory leaks in UUID regressions
8652504 is described below

commit 8652504331afd6268552f3197644235cdc51c4f5
Author: Leif Hedstrom <zw...@apache.org>
AuthorDate: Tue Jun 28 09:45:37 2016 -0600

    TS-4518 Eliminate memory leaks in UUID regressions
---
 proxy/InkAPITest.cc | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/proxy/InkAPITest.cc b/proxy/InkAPITest.cc
index 567c218..b0f164b 100644
--- a/proxy/InkAPITest.cc
+++ b/proxy/InkAPITest.cc
@@ -7834,7 +7834,7 @@ REGRESSION_TEST(SDK_API_UUID)(RegressionTest *test, int /* atype ATS_UNUSED */,
     if (TS_SUCCESS != TSUuidInitialize(uuid, TS_UUID_V4)) {
       SDK_RPRINT(test, "TSUuidInitialize", "TestCase1", TC_FAIL, "Failed to Initialize a V4 UUID");
       *pstatus = REGRESSION_TEST_FAILED;
-      return;
+      goto cleanup;
     } else {
       SDK_RPRINT(test, "TSUuidInitialize", "TestCase1", TC_PASS, "ok");
     }
@@ -7844,7 +7844,7 @@ REGRESSION_TEST(SDK_API_UUID)(RegressionTest *test, int /* atype ATS_UNUSED */,
   if (TS_UUID_V4 != TSUuidVersionGet(uuid)) {
     SDK_RPRINT(test, "TSUuidVersionGet", "TestCase1", TC_FAIL, "Failed to get the UUID version");
     *pstatus = REGRESSION_TEST_FAILED;
-    return;
+    goto cleanup;
   } else {
     SDK_RPRINT(test, "TSUuidVersionGet", "TestCase1", TC_PASS, "ok");
   }
@@ -7853,14 +7853,14 @@ REGRESSION_TEST(SDK_API_UUID)(RegressionTest *test, int /* atype ATS_UNUSED */,
   if (TS_SUCCESS != TSUuidCopy(uuid, machine)) {
     SDK_RPRINT(test, "TSUuidCopy", "TestCase1", TC_FAIL, "Failed to copy the Machine UUID object");
     *pstatus = REGRESSION_TEST_FAILED;
-    return;
+    goto cleanup;
   } else {
     SDK_RPRINT(test, "TSUuidCopy", "TestCase1", TC_PASS, "ok");
     str2 = TSUuidStringGet(uuid);
     if (!str2 || (TS_UUID_STRING_LEN != strlen(str2)) || strcmp(str1, str2)) {
       SDK_RPRINT(test, "TSUuidCopy", "TestCase2", TC_FAIL, "The copied UUID strings are not identical");
       *pstatus = REGRESSION_TEST_FAILED;
-      return;
+      goto cleanup;
     } else {
       SDK_RPRINT(test, "TSUuidCopy", "TestCase2", TC_PASS, "ok");
     }
@@ -7870,14 +7870,14 @@ REGRESSION_TEST(SDK_API_UUID)(RegressionTest *test, int /* atype ATS_UNUSED */,
   if (TS_SUCCESS != TSUuidInitialize(uuid, TS_UUID_V4)) {
     SDK_RPRINT(test, "TSUuidInitialize", "TestCase2", TC_FAIL, "Failed to re-initialize the UUID object");
     *pstatus = REGRESSION_TEST_FAILED;
-    return;
+    goto cleanup;
   } else {
     SDK_RPRINT(test, "TSUuidInitialize", "TestCase2", TC_PASS, "ok");
     str2 = TSUuidStringGet(uuid);
     if (!str2 || (TS_UUID_STRING_LEN != strlen(str2)) || !strcmp(str1, str2)) {
       SDK_RPRINT(test, "TSUuidInitialize", "TestCase3", TC_FAIL, "The re-initialized string is the same as before");
       *pstatus = REGRESSION_TEST_FAILED;
-      return;
+      goto cleanup;
     } else {
       SDK_RPRINT(test, "TSUuidInitialize", "TestCase3", TC_PASS, "ok");
     }
@@ -7887,14 +7887,14 @@ REGRESSION_TEST(SDK_API_UUID)(RegressionTest *test, int /* atype ATS_UNUSED */,
   if ((TS_SUCCESS != TSUuidStringParse(uuid, uuid_v1)) || (TS_UUID_V1 != TSUuidVersionGet(uuid))) {
     SDK_RPRINT(test, "TSUuidStringParse", "TestCase1", TC_FAIL, "Failed to parse the UUID v1 string");
     *pstatus = REGRESSION_TEST_FAILED;
-    return;
+    goto cleanup;
   } else {
     SDK_RPRINT(test, "TSUuidStringParse", "TestCase1", TC_PASS, "ok");
     str1 = TSUuidStringGet(uuid);
     if (!str1 || (TS_UUID_STRING_LEN != strlen(str1)) || strcmp(str1, uuid_v1)) {
       SDK_RPRINT(test, "TSUuidStringString", "TestCase2", TC_FAIL, "The parse UUID v1 string does not match the original");
       *pstatus = REGRESSION_TEST_FAILED;
-      return;
+      goto cleanup;
     } else {
       SDK_RPRINT(test, "TSUuidStringParse", "TestCase2", TC_PASS, "ok");
     }
@@ -7902,21 +7902,23 @@ REGRESSION_TEST(SDK_API_UUID)(RegressionTest *test, int /* atype ATS_UNUSED */,
   if ((TS_SUCCESS != TSUuidStringParse(uuid, uuid_v4)) || (TS_UUID_V4 != TSUuidVersionGet(uuid))) {
     SDK_RPRINT(test, "TSUuidStringParse", "TestCase3", TC_FAIL, "Failed to parse the UUID v4 string");
     *pstatus = REGRESSION_TEST_FAILED;
-    return;
+    goto cleanup;
   } else {
     SDK_RPRINT(test, "TSUuidStringParse", "TestCase3", TC_PASS, "ok");
     str1 = TSUuidStringGet(uuid);
     if (!str1 || (TS_UUID_STRING_LEN != strlen(str1)) || strcmp(str1, uuid_v4)) {
       SDK_RPRINT(test, "TSUuidStringParse", "TestCase4", TC_FAIL, "The parse UUID v4 string does not match the original");
       *pstatus = REGRESSION_TEST_FAILED;
-      return;
+      goto cleanup;
     } else {
       SDK_RPRINT(test, "TSUuidStringParse", "TestCase4", TC_PASS, "ok");
     }
   }
 
+  *pstatus = REGRESSION_TEST_PASSED;
+
+cleanup:
   TSUuidDestroy(uuid);
 
-  *pstatus = REGRESSION_TEST_PASSED;
   return;
 }

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].