From cc7c064421509ffecae22bf9d8d7b14b5919cf6c Mon Sep 17 00:00:00 2001 From: Austin Blanton Date: Fri, 13 Dec 2013 11:58:23 -0500 Subject: [PATCH] Add C API functions to free memory for Template and TemplateList pointers --- openbr/openbr.cpp | 12 ++++++++++++ openbr/openbr.h | 8 ++++++++ 2 files changed, 20 insertions(+), 0 deletions(-) diff --git a/openbr/openbr.cpp b/openbr/openbr.cpp index 13c648f..981d000 100644 --- a/openbr/openbr.cpp +++ b/openbr/openbr.cpp @@ -323,6 +323,18 @@ unsigned char *br_unload_img(br_template tmpl) return t->m().data; } +void br_free_template(br_template tmpl) +{ + Template *t = reinterpret_cast(tmpl); + delete t; +} + +void br_free_template_list(br_template_list tl) +{ + TemplateList *realTL = reinterpret_cast(tl); + delete realTL; +} + int br_img_rows(br_template tmpl) { Template *t = reinterpret_cast(tmpl); diff --git a/openbr/openbr.h b/openbr/openbr.h index 6050a1f..fdecfc7 100644 --- a/openbr/openbr.h +++ b/openbr/openbr.h @@ -452,6 +452,14 @@ BR_EXPORT br_template br_load_img(const char *data, int len); */ BR_EXPORT unsigned char* br_unload_img(br_template tmpl); /*! + * \brief Free a br::Template's memory. + */ +BR_EXPORT void br_free_template(br_template tmpl); +/*! + * \brief Free a br::TemplateList's memory. + */ +BR_EXPORT void br_free_template_list(br_template_list tl); +/*! * \brief Get the number of rows in an image. * \param tmpl Pointer to a br::Template. */ -- libgit2 0.21.4