From 8f4b6ec98525599e7f7af05c1b8edf62f9f16b06 Mon Sep 17 00:00:00 2001 From: Antony Polukhin Date: Fri, 25 Sep 2015 19:58:48 +0300 Subject: [PATCH] Fixed issue from track Ticket #11209: conversion - cast_test leaks memory --- test/cast_test.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/cast_test.cpp b/test/cast_test.cpp index 5295e32..e754dbb 100644 --- a/test/cast_test.cpp +++ b/test/cast_test.cpp @@ -51,7 +51,8 @@ int main( int argc, char * argv[] ) // test polymorphic_cast ---------------------------------------------------// // tests which should succeed - Base * base = new Derived; + Derived derived_instance; + Base * base = &derived_instance; Base2 * base2 = 0; Derived * derived = 0; derived = polymorphic_downcast( base ); // downcast @@ -66,7 +67,8 @@ int main( int argc, char * argv[] ) // tests which should result in errors being detected int err_count = 0; - base = new Base; + Base base_instance; + base = &base_instance; if ( argc > 1 && *argv[1] == '1' ) { derived = polymorphic_downcast( base ); } // #1 assert failure