Take a look at his API Guide. If it is a C API, you probably should free it. If it does not provide its own function, e.g. sqlite3_free (e.g. pcre), you should use this function.
What you cannot do is delete it using the C ++ delete operator, since you have a pointer to void. You cannot delete the void pointer, because the compiler must know about its type. (and void is an incomplete type, you also cannot remove incomplete types).
source share