Skip to content

Commit

Permalink
Fixing memory leak in NCBM solver.
Browse files Browse the repository at this point in the history
  • Loading branch information
tklein23 committed Mar 16, 2014
1 parent 4e1874a commit 18577fd
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/shogun/structure/libncbm.cpp
Expand Up @@ -321,7 +321,9 @@ BmrmStatistics svm_ncbm_solver(
{
BmrmStatistics ncbm;
libqp_state_T qp_exitflag={0, 0, 0, 0};
int32_t w_dim = machine->get_model()->get_dim();

CStructuredModel* model = machine->get_model();
int32_t w_dim = model->get_dim();

maxCPs = _BufSize;
BufSize = _BufSize;
Expand Down Expand Up @@ -756,6 +758,17 @@ BmrmStatistics svm_ncbm_solver(
LIBBMRM_FREE(icp_stats.ACPs);
LIBBMRM_FREE(icp_stats.H_buff);

cp_ptr=CPList_head;
while(cp_ptr!=NULL)
{
bmrm_ll * cp_ptr_this=cp_ptr;
cp_ptr=cp_ptr->next;
LIBBMRM_FREE(cp_ptr_this);
cp_ptr_this=NULL;
}

SG_UNREF(model);

return ncbm;
}

Expand Down

0 comments on commit 18577fd

Please sign in to comment.