From: Mikko Rasa Date: Mon, 26 Dec 2022 12:45:50 +0000 (+0200) Subject: Avoid a memory leak if Builder::set_architecture is called again X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=dd5f5ca28944ed2f8ddd62f8af672ed003938a8f;p=builder.git Avoid a memory leak if Builder::set_architecture is called again --- diff --git a/source/builder.cpp b/source/builder.cpp index 3fbb1b6..6f90c9d 100644 --- a/source/builder.cpp +++ b/source/builder.cpp @@ -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;