Hello! Thanks for reporting!
It would be best if you submitted your patch directly upstream at https://github.com/mariadb-corporation/mariadb-connector-c/ They have the best knowledge to assess if this change is OK or if it has potential regressions.