[CONCPP-63] Thrown Exceptions created by ExceptionFactory::create() could leak memory Created: 2021-02-04  Updated: 2021-02-08  Resolved: 2021-02-08

Status: Closed
Project: MariaDB Connector/C++
Component/s: General
Affects Version/s: 0.9.4, 1.0.0
Fix Version/s: 1.0.0

Type: Bug Priority: Major
Reporter: Lawrin Novitsky Assignee: Lawrin Novitsky
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

If the created exception was a subclass as SQLException, it(or it's copy) would eventually be destructed as SQLException. Thus, everything but SQLException would leak. That happened, because as a quick solution at the time, they all were thrown as SQLException. Caught as SQLException&(they could not be caught as an exception of its own class), they would be destructed as SQLException.
As a solution, create will throw right away the correct type of exception. Anyway It's only used to be thrown everywhere. And seemingly there is no sense to keep it returning exception object. Once such need arises, it can be changed



 Comments   
Comment by Lawrin Novitsky [ 2021-02-08 ]

Commit 96e5040

Generated at Thu Feb 08 03:08:04 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.