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:54:52 +0000 (22:54 +0200)
This was reported by Martin Ettl <ettl.martin@gmx.de>.

ginac/excompiler.cpp

index 375776d8e1428595f1ce4a8d42c9ac9f8f8d6e7e..8d6670f1d48f28ee1593e86457a0c475dbabf87f 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);