Commit cc7c064421509ffecae22bf9d8d7b14b5919cf6c

Authored by Austin Blanton
1 parent abd03516

Add C API functions to free memory for Template and TemplateList pointers

openbr/openbr.cpp
... ... @@ -323,6 +323,18 @@ unsigned char *br_unload_img(br_template tmpl)
323 323 return t->m().data;
324 324 }
325 325  
  326 +void br_free_template(br_template tmpl)
  327 +{
  328 + Template *t = reinterpret_cast<Template*>(tmpl);
  329 + delete t;
  330 +}
  331 +
  332 +void br_free_template_list(br_template_list tl)
  333 +{
  334 + TemplateList *realTL = reinterpret_cast<TemplateList*>(tl);
  335 + delete realTL;
  336 +}
  337 +
326 338 int br_img_rows(br_template tmpl)
327 339 {
328 340 Template *t = reinterpret_cast<Template*>(tmpl);
... ...
openbr/openbr.h
... ... @@ -452,6 +452,14 @@ BR_EXPORT br_template br_load_img(const char *data, int len);
452 452 */
453 453 BR_EXPORT unsigned char* br_unload_img(br_template tmpl);
454 454 /*!
  455 + * \brief Free a br::Template's memory.
  456 + */
  457 +BR_EXPORT void br_free_template(br_template tmpl);
  458 +/*!
  459 + * \brief Free a br::TemplateList's memory.
  460 + */
  461 +BR_EXPORT void br_free_template_list(br_template_list tl);
  462 +/*!
455 463 * \brief Get the number of rows in an image.
456 464 * \param tmpl Pointer to a br::Template.
457 465 */
... ...