Skip to content

Commit

Permalink
fix double free errors in mkl / combined kernel / wds kernel
Browse files Browse the repository at this point in the history
  • Loading branch information
Soeren Sonnenburg committed May 5, 2012
1 parent d847327 commit b27af96
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/shogun/classifier/mkl/MKL.cpp
Expand Up @@ -252,7 +252,7 @@ bool CMKL::train_machine(CFeatures* data)
beta, num_kernels); //q-norm = 1
}

kernel->set_subkernel_weights(SGVector<float64_t>(beta, num_kernels));
kernel->set_subkernel_weights(SGVector<float64_t>(beta, num_kernels, false));
SG_FREE(beta);

svm->set_bias_enabled(get_bias_enabled());
Expand Down Expand Up @@ -452,7 +452,7 @@ bool CMKL::perform_mkl_step(
w_gap = CMath::abs(1-rho/mkl_objective) ;
}

kernel->set_subkernel_weights(SGVector<float64_t>(beta, num_kernels));
kernel->set_subkernel_weights(SGVector<float64_t>(beta, num_kernels, false));
SG_FREE(beta);

return converged();
Expand Down
2 changes: 1 addition & 1 deletion src/shogun/kernel/CombinedKernel.cpp
Expand Up @@ -704,7 +704,7 @@ void CCombinedKernel::set_subkernel_weights(SGVector<float64_t> weights)
{
int32_t num = k->get_num_subkernels() ;
ASSERT(i<weights.vlen);
k->set_subkernel_weights(SGVector<float64_t>(&weights.vector[i],num));
k->set_subkernel_weights(SGVector<float64_t>(&weights.vector[i],num, false));

SG_UNREF(k);
k = get_next_kernel(current);
Expand Down
4 changes: 2 additions & 2 deletions src/shogun/kernel/WeightedDegreePositionStringKernel.cpp
Expand Up @@ -195,7 +195,7 @@ bool CWeightedDegreePositionStringKernel::init(CFeatures* l, CFeatures* r)
for (int32_t i=0; i<shift_len; i++) {
shifts[i]=1;
}
set_shifts(SGVector<int32_t>(shifts, shift_len));
set_shifts(SGVector<int32_t>(shifts, shift_len, false));
SG_FREE(shifts);
}

Expand Down Expand Up @@ -1862,7 +1862,7 @@ void CWeightedDegreePositionStringKernel::compute_POIM2(

SGVector<float64_t> CWeightedDegreePositionStringKernel::get_POIM2()
{
SGVector<float64_t> poim(m_poim, m_poim_result_len);
SGVector<float64_t> poim(m_poim, m_poim_result_len, false);
return poim;
}

Expand Down

0 comments on commit b27af96

Please sign in to comment.