|
Boost Users : |
Subject: Re: [Boost-users] [Boost.Test] valgrind complains about invalid reads
From: Peter Klotz (peter.klotz_at_[hidden])
Date: 2008-11-14 17:11:11
James Sutherland wrote:
> Try compiling a debug version. That will give you line numbers to help
> you track it down easier.
> James
Found the problem. It was a non virtual destructor in class test_unit.
Since test_unit is the base class of test_case, test_suite and
master_test_suite_t it needs a virtual destructor.
In deregister_test_unit() a test_unit* pointer is passed which may
actually point to a derived class. Calling delete without a virtual
destructor leads to undefined behavior (and makes valgrind complain).
The attached patch against 1.37.0 fixes this problem.
Regards, Peter.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net