From 91356abaf6cb09a1c72f9a8c374487ab66ecde13 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Tue, 5 Jul 2011 01:45:46 +0000 Subject: Corrected a potential memory leak in the ASE reader. --- src/model/asefile.cc | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/model') diff --git a/src/model/asefile.cc b/src/model/asefile.cc index ad62029..0a10d04 100644 --- a/src/model/asefile.cc +++ b/src/model/asefile.cc @@ -654,16 +654,11 @@ Model *ASEFile::load(const std::string &name) { ASEFile asefile(name); - if (!asefile.is_open()) { + if (!asefile.is_open() || !asefile.read() || asefile.fragmentgroup()->size()) { + // the fragmentgroup is not deleted by the destructor + delete asefile.fragmentgroup(); return 0; } - - if (!asefile.read()) { - return 0; - } - - if (!asefile.fragmentgroup()->size()) - return 0; // create a new model Model *model = new Model(name); -- cgit v1.2.3