Updated by Alexander Shishkov about 13 years ago
A sample program is attached.
After CvEM [[CvEM]] read from a file, when the lifetime of the instance of CvEM [[CvEM]] terminated, the program crashes.
The reason is, when CvEM [[CvEM]] reads the covs and rotated_cov_mats, covs is allocated the whole memory block required by covs and rotated_cov_mats, and rotated_cov_mats = covs + [some offset]
This leads to a "double delete" in the destructor of CvEM, [[CvEM]], since when the memory pointed by covs is released, rotated_cov_mats becomes a wild pointer, so a "delete rotated_cov_mats" crash the program.
After CvEM [[CvEM]] read from a file, when the lifetime of the instance of CvEM [[CvEM]] terminated, the program crashes.
The reason is, when CvEM [[CvEM]] reads the covs and rotated_cov_mats, covs is allocated the whole memory block required by covs and rotated_cov_mats, and rotated_cov_mats = covs + [some offset]
This leads to a "double delete" in the destructor of CvEM, [[CvEM]], since when the memory pointed by covs is released, rotated_cov_mats becomes a wild pointer, so a "delete rotated_cov_mats" crash the program.