Skip to content

Commit

Permalink
dpm memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
liuliu committed Jun 29, 2012
1 parent 2f91b5f commit 8a6fd19
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bin/dpmdetect.c
Expand Up @@ -30,7 +30,7 @@ int main(int argc, char** argv)
ccv_root_comp_t* comp = (ccv_root_comp_t*)ccv_array_get(seq, i);
printf("%d %d %d %d %f %d\n", comp->rect.x, comp->rect.y, comp->rect.width, comp->rect.height, comp->confidence, comp->pnum);
for (j = 0; j < comp->pnum; j++)
printf("| %d %d %d %d %f\n", comp->part[j].rect.x, comp->part[j].rect.y, comp->part[j].rect.width, comp->part[j].rect.height, comp->part[j].confidence);
printf("| %d %d %d %d %f\n", comp->part[j].rect.x, comp->part[j].rect.y, comp->part[j].rect.width, comp->part[j].rect.height, comp->part[j].confidence);
}
printf("total : %d in time %dms\n", seq->rnum, elapsed_time);
ccv_array_free(seq);
Expand Down Expand Up @@ -63,7 +63,7 @@ int main(int argc, char** argv)
ccv_root_comp_t* comp = (ccv_root_comp_t*)ccv_array_get(seq, i);
printf("%s %d %d %d %d %f %d\n", file, comp->rect.x, comp->rect.y, comp->rect.width, comp->rect.height, comp->confidence, comp->pnum);
for (j = 0; j < comp->pnum; j++)
printf("| %d %d %d %d %f\n", comp->part[j].rect.x, comp->part[j].rect.y, comp->part[j].rect.width, comp->part[j].rect.height, comp->part[j].confidence);
printf("| %d %d %d %d %f\n", comp->part[j].rect.x, comp->part[j].rect.y, comp->part[j].rect.width, comp->part[j].rect.height, comp->part[j].confidence);
}
ccv_array_free(seq);
}
Expand All @@ -74,5 +74,6 @@ int main(int argc, char** argv)
}
}
ccv_drain_cache();
ccv_dpm_mixture_model_free(model);
return 0;
}
2 changes: 2 additions & 0 deletions lib/ccv_dpm.c
Expand Up @@ -1992,12 +1992,14 @@ ccv_dpm_mixture_model_t* ccv_load_dpm_mixture_model(const char* directory)
model->root = (ccv_dpm_root_classifier_t*)m;
m += sizeof(ccv_dpm_root_classifier_t) * model->count;
memcpy(model->root, root_classifier, sizeof(ccv_dpm_root_classifier_t) * model->count);
ccfree(root_classifier);
for (i = 0; i < model->count; i++)
{
ccv_dpm_part_classifier_t* part_classifier = model->root[i].part;
model->root[i].part = (ccv_dpm_part_classifier_t*)m;
m += sizeof(ccv_dpm_part_classifier_t) * model->root[i].count;
memcpy(model->root[i].part, part_classifier, sizeof(ccv_dpm_part_classifier_t) * model->root[i].count);
ccfree(part_classifier);
}
for (i = 0; i < model->count; i++)
{
Expand Down

0 comments on commit 8a6fd19

Please sign in to comment.