]> git.tdb.fi Git - builder.git/commitdiff
Avoid a memory leak if Builder::set_architecture is called again
authorMikko Rasa <tdb@tdb.fi>
Mon, 26 Dec 2022 12:45:50 +0000 (14:45 +0200)
committerMikko Rasa <tdb@tdb.fi>
Mon, 26 Dec 2022 19:12:50 +0000 (21:12 +0200)
source/builder.cpp

index 3fbb1b6c4d56d7e4eb3daa04047857cf0ade8c03..6f90c9d417598747e74daedac3bb7e7e30301631 100644 (file)
@@ -48,6 +48,9 @@ Builder::~Builder()
 
 void Builder::set_architecture(const string &name)
 {
+       if(current_arch!=&native_arch)
+               delete current_arch;
+
        if(name.empty())
        {
                current_arch = &native_arch;