]> www.ginac.de Git - ginac.git/blobdiff - ginac/parser/parser.cpp
Fixed memory leak.
[ginac.git] / ginac / parser / parser.cpp
index 818203162e7dc4421d61a30af8613e3353b60653..6ed364ffd5a155ae0bb5abeec567a8f17e3ffbaf 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;
        }