crash with mariadb and jemalloc
Opened this issue · 1 comments
See https://mariadb.atlassian.net/browse/MDEV-6005 and in particular the last comment (https://mariadb.atlassian.net/browse/MDEV-6005?focusedCommentId=48714) that explains the bug
Solved. Not very elegant, but working.
I submit this diff patch which consists in differentiating the two calls at pregMoveToReturnValues made in lib_mysqludf_preg_replace.c and in lib_mysqludf_preg_capture.c with a seventh parameter indicating to pregMoveToReturnValues the way to free the memory allocated to parameter "s" (in lib_mysqludf_preg_replace.c was allocated by pregReplace with memcpyand supposed to be freed by free() and in lib_mysqludf_preg_capture.c was allocated by pcre_get_substring and supposed to be freed by pcre_free_substring() ).