Fixed double-free in LLModel::Implementation destructor

This commit is contained in:
niansa 2023-06-01 17:16:33 +02:00 committed by AT
parent ae20274a1d
commit ab56119470
2 changed files with 12 additions and 1 deletions

View File

@ -34,8 +34,17 @@ LLModel::Implementation::Implementation(Dlhandle &&dlhandle_) : dlhandle(new Dlh
assert(construct_); assert(construct_);
} }
LLModel::Implementation::Implementation(Implementation &&o)
: construct_(o.construct_)
, modelType(o.modelType)
, buildVariant(o.buildVariant)
, magicMatch(o.magicMatch)
, dlhandle(o.dlhandle) {
o.dlhandle = nullptr;
}
LLModel::Implementation::~Implementation() { LLModel::Implementation::~Implementation() {
delete dlhandle; if (dlhandle) delete dlhandle;
} }
bool LLModel::Implementation::isImplementation(const Dlhandle &dl) { bool LLModel::Implementation::isImplementation(const Dlhandle &dl) {

View File

@ -17,6 +17,8 @@ public:
public: public:
Implementation(Dlhandle&&); Implementation(Dlhandle&&);
Implementation(const Implementation&) = delete;
Implementation(Implementation&&);
~Implementation(); ~Implementation();
static bool isImplementation(const Dlhandle&); static bool isImplementation(const Dlhandle&);