Skip to content

Commit

Permalink
Merge pull request #2014 from tklein23/fix_libncbm_leak
Browse files Browse the repository at this point in the history
Fixing memory leaks in NCBM solver.
  • Loading branch information
vigsterkr committed Mar 17, 2014
2 parents f971d4f + 18577fd commit 6ee3991
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 6ee3991

Please sign in to comment.