Fix a memory leak in the Mat copying constructor
authorIgor Wodiany <igor.wodiany@gmail.com>
Wed, 4 Oct 2017 21:54:40 +0000 (22:54 +0100)
committerAlexander Alekhin <alexander.a.alekhin@gmail.com>
Sat, 7 Oct 2017 07:50:17 +0000 (10:50 +0300)
commitb638aa74d77d85bf031ea2e0d676bedf6466a1c0
treebe3f431a287731b1ad78957fc0ea8fbd8989b8ab
parentd25ee8a273233a35a6dc62f7ded840f8e85366c0
Fix a memory leak in the Mat copying constructor

Exception may be rasied inside the body of a copying constructor after
refcount has been increased, and beacause in the case of the exception
destrcutor is never called what causes memory leak. This commit adds a
workaround that calls the release() function before the exception is
thrown outside the contructor.
modules/core/src/matrix.cpp