Fix memory leak when exporting a file fails

Originally committed to SVN as r4420.
This commit is contained in:
Thomas Goyne 2010-06-03 20:32:03 +00:00
parent f064624ecd
commit ca24f60a7e

View file

@ -34,11 +34,12 @@
/// @ingroup export /// @ingroup export
/// ///
///////////
// Headers
#include "config.h" #include "config.h"
#ifndef AGI_PRE
#include <memory>
#endif
#include "ass_export_filter.h" #include "ass_export_filter.h"
#include "ass_exporter.h" #include "ass_exporter.h"
#include "ass_file.h" #include "ass_file.h"
@ -169,12 +170,8 @@ AssFile *AssExporter::ExportTransform(wxWindow *export_dialog) {
/// @param export_dialog /// @param export_dialog
/// ///
void AssExporter::Export(wxString filename, wxString charset, wxWindow *export_dialog) { void AssExporter::Export(wxString filename, wxString charset, wxWindow *export_dialog) {
// Get transformation std::auto_ptr<AssFile> Subs(ExportTransform(export_dialog));
AssFile *Subs = ExportTransform(export_dialog);
// Save
Subs->Save(filename,false,false,charset); Subs->Save(filename,false,false,charset);
delete Subs;
} }