Skip to content

Commit

Permalink
Fixed map memory handling for sgvector value case
Browse files Browse the repository at this point in the history
  • Loading branch information
lisitsyn committed Aug 12, 2012
1 parent a2eff59 commit a805d7f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Expand Up @@ -217,6 +217,7 @@ int main(int argc, char **argv)
SG_UNREF(grad_search);
SG_UNREF(best_combination);
SG_UNREF(result);
SG_UNREF(mean);

exit_shogun();

Expand Down
Expand Up @@ -216,6 +216,7 @@ int main(int argc, char **argv)
SG_UNREF(grad_search);
SG_UNREF(best_combination);
SG_UNREF(result);
SG_UNREF(mean);

exit_shogun();

Expand Down
10 changes: 7 additions & 3 deletions src/shogun/lib/Map.h
Expand Up @@ -436,12 +436,16 @@ IGNORE_IN_CLASSLIST template<class K, class T> class CMap: public CSGObject
{
for(int32_t i=0; i<array->get_num_elements(); i++)
{
if (array->get_element(i)!=NULL)
CMapNode<K, T>* element = array->get_element(i);
if (element!=NULL)
{
element->key = K();
element->data = T();

if (use_sg_mallocs)
SG_FREE(array->get_element(i));
SG_FREE(element);
else
free(array->get_element(i));
free(element);
}
}
delete array;
Expand Down

0 comments on commit a805d7f

Please sign in to comment.