Fix memory leak in excompiler due to use of wrong operator delete.
authorRichard Kreckel <kreckel@ginac.de>
Thu, 13 May 2010 20:54:52 +0000 (22:54 +0200)
committerRichard Kreckel <kreckel@ginac.de>
Thu, 13 May 2010 20:59:42 +0000 (22:59 +0200)
This was reported by Martin Ettl <ettl.martin@gmx.de>.

ginac/excompiler.cpp

index 375776d..8d6670f 100644 (file)
@@ -113,12 +113,12 @@ public:
                        char* new_filename = new char[strlen(filename_pattern)+1];
                        strcpy(new_filename, filename_pattern);
                        if (!mktemp(new_filename)) {
-                               delete new_filename;
+                               delete[] new_filename;
                                throw std::runtime_error("mktemp failed");
                        }
                        filename = std::string(new_filename);
                        ofs.open(new_filename, std::ios::out);
-                       delete new_filename;
+                       delete[] new_filename;
                } else {
                        // use parameter as filename
                        ofs.open(filename.c_str(), std::ios::out);