Search code examples
cpcre

How to free memory allocated by pcre2_get_ovector_pointer method?


How to properly free\release memory allocated by pcre2_get_ovector_pointer method of pcre2 library?

For example:

PCRE2_SIZE *ovector;
ovector = pcre2_get_ovector_pointer(match_data);

So, how to release the ovector pointer?


Solution

  • You shouldn't. ovector points to data within match_data.

    You need to free match_data using.

    pcre2_match_data_free(match_data);
    

    example