]> www.ginac.de Git - ginac.git/commitdiff
Fixed memory leak.
authorJens Vollinga <jensv@balin.nikhef.nl>
Fri, 31 Jul 2009 15:54:16 +0000 (17:54 +0200)
committerAlexei Sheplyakov <Alexei.Sheplyakov@gmail.com>
Thu, 9 Dec 2010 18:46:38 +0000 (20:46 +0200)
ginac/parser/parser.cpp

index 3fa40c92bd6c1a523b94d79f671bcec68afca3f7..52f7e1df3454c9df01b5dc9f90511d4373260397 100644 (file)
@@ -68,11 +68,12 @@ ex parser::parse_identifier_expr()
        }
        // dirty hack to distinguish between serial numbers of functions and real
        // pointers.
        }
        // dirty hack to distinguish between serial numbers of functions and real
        // pointers.
-       GiNaC::function* f;
+       GiNaC::function* f = NULL;
        try {
                f = new GiNaC::function(reinterpret_cast<unsigned>(reader->second), args);
        }
        catch ( std::runtime_error ) {
        try {
                f = new GiNaC::function(reinterpret_cast<unsigned>(reader->second), args);
        }
        catch ( std::runtime_error ) {
+               if ( f ) delete f;
                ex ret = reader->second(args);
                return ret;
        }
                ex ret = reader->second(args);
                return ret;
        }