Skip to content

Commit

Permalink
avoid (not really ) a leak reported by some tools
Browse files Browse the repository at this point in the history
  • Loading branch information
wojdyr committed Dec 17, 2016
1 parent 2e17a4f commit 63d3ffc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion xyconv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,13 +203,14 @@ int convert_file(string const& input, string const& output,
string const& filetype, string const& options,
bool with_metadata)
{
xylib::DataSet *d = NULL;
try {
#ifdef _WIN32
string input_s = short_path(input.c_str());
#else
const string& input_s = input;
#endif
xylib::DataSet *d = xylib::load_file(input_s, filetype, options);
d = xylib::load_file(input_s, filetype, options);
// validate options
for (const char *p = options.c_str(); *p != '\0'; ) {
while (isspace(*p))
Expand All @@ -228,6 +229,7 @@ int convert_file(string const& input, string const& output,
delete d;
} catch (runtime_error const& e) {
cerr << "Error. " << e.what() << endl;
delete d;
return -1;
}
return 0;
Expand Down

0 comments on commit 63d3ffc

Please sign in to comment.