You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rm...@apache.org on 2022/03/27 21:20:34 UTC

[logging-log4cxx] branch unittest-fix-framework created (now 8cae5e0)

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

rmiddleton pushed a change to branch unittest-fix-framework
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git.


      at 8cae5e0  convert to using new so constructor will run

This branch includes the following new commits:

     new 8cae5e0  convert to using new so constructor will run

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[logging-log4cxx] 01/01: convert to using new so constructor will run

Posted by rm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rmiddleton pushed a commit to branch unittest-fix-framework
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git

commit 8cae5e0c6f0785fc70d01c432788425c124d1192
Author: Robert Middleton <ro...@rm5248.com>
AuthorDate: Sun Mar 27 17:20:21 2022 -0400

    convert to using new so constructor will run
---
 src/test/cpp/abts.cpp | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/src/test/cpp/abts.cpp b/src/test/cpp/abts.cpp
index c26ebd8..d40ec64 100644
--- a/src/test/cpp/abts.cpp
+++ b/src/test/cpp/abts.cpp
@@ -127,7 +127,7 @@ abts_suite* abts_add_suite(abts_suite* suite, const char* suite_name_full)
 		end_suite(suite);
 	}
 
-	subsuite = (sub_suite*) malloc(sizeof(*subsuite));
+	subsuite = new sub_suite();
 	subsuite->num_test = 0;
 	subsuite->failed.clear();
 	subsuite->next = NULL;
@@ -165,7 +165,7 @@ abts_suite* abts_add_suite(abts_suite* suite, const char* suite_name_full)
 
 	if (suite == NULL)
 	{
-		suite = (abts_suite*) malloc(sizeof(*suite));
+		suite = new abts_suite();
 		suite->head = subsuite;
 		suite->tail = subsuite;
 	}
@@ -600,16 +600,17 @@ int main(int argc, const char* const argv[])
 		//
 		//    clean up suite
 		//
-		sub_suite* next;
+		// We're about to exit, who cares about memory leaks?
+//		sub_suite* next;
 
-		for (sub_suite* head = suite->head; head != NULL; head = next)
-		{
-			next = head->next;
-			free((void*) head->name);
-			free(head);
-		}
+//		for (sub_suite* head = suite->head; head != NULL; head = next)
+//		{
+//			next = head->next;
+//			delete[] head->name;
+//			delete head;
+//		}
 
-		free(suite);
+//		delete suite;
 	}
 
 	return rv;