Initialize these to nullptr to prevent double deletion when a model fails to load.

This commit is contained in:
Adam Treat 2023-06-20 18:23:45 -04:00
parent 85bc861835
commit bd58c46da0
3 changed files with 3 additions and 0 deletions

View File

@ -833,6 +833,7 @@ struct GPTJPrivate {
GPTJ::GPTJ() GPTJ::GPTJ()
: d_ptr(new GPTJPrivate) { : d_ptr(new GPTJPrivate) {
d_ptr->model = new gptj_model; d_ptr->model = new gptj_model;
d_ptr->model->ctx = nullptr;
d_ptr->modelLoaded = false; d_ptr->modelLoaded = false;
} }

View File

@ -757,6 +757,7 @@ struct MPTPrivate {
MPT::MPT() MPT::MPT()
: d_ptr(new MPTPrivate) { : d_ptr(new MPTPrivate) {
d_ptr->model = new mpt_model; d_ptr->model = new mpt_model;
d_ptr->model->ctx = nullptr;
d_ptr->modelLoaded = false; d_ptr->modelLoaded = false;
} }

View File

@ -884,6 +884,7 @@ Replit::Replit()
: d_ptr(new ReplitPrivate) { : d_ptr(new ReplitPrivate) {
d_ptr->model = new replit_model; d_ptr->model = new replit_model;
d_ptr->model->ctx = nullptr;
d_ptr->modelLoaded = false; d_ptr->modelLoaded = false;
} }