Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2011-07-05 01:45:46 +0000
committerStijn Buys <ingar@osirion.org>2011-07-05 01:45:46 +0000
commit91356abaf6cb09a1c72f9a8c374487ab66ecde13 (patch)
treed55e1eb9471550a2fc10ea77dd5cdf3f6ab56d3f /src
parent16928d56524a4d88ba74afef01cd7e8887d82dde (diff)
Corrected a potential memory leak in the ASE reader.
Diffstat (limited to 'src')
-rw-r--r--src/model/asefile.cc11
1 files changed, 3 insertions, 8 deletions
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);