Bug #33286 debug build of libmysql exposes wrong my_malloc/my_free functions
Submitted: 17 Dec 2007 10:29 Modified: 17 Dec 2007 22:31
Reporter: Jess Balint Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: C API (client library) Severity:S3 (Non-critical)
Version:5.0/5.1 OS:Microsoft Windows
Assigned to: CPU Architecture:Any
Tags: libmysql, SAFEMALLOC
Triage: D4 (Minor) / R2 (Low) / E3 (Medium)

[17 Dec 2007 10:29] Jess Balint
Description:
when doing a debug build on windows, SAFEMALLOC is defined and used internally. however, config-win.h does not define SAFEMALLOC and any application using my_malloc/my_free from libmysql will get the "non-safe" versions.

How to repeat:
this is a problem when trying to free memory allocated internally, eg. calling list_cons() (this uses the safe my_malloc internally) and later freeing the list node with my_free() (which won't use the safe my_free).

Suggested fix:
Since config-win.h is not generated, this may need to be a documented convention to add SAFEMALLOC if using a debug-built libmysql on windows.

I have not checked if this is placed in the my_config.h file on linux/unix, but it needs to be checked for the same issue.
[17 Dec 2007 22:31] Miguel Solorzano
Thank you for the bug report.