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