Skip Menu |

This queue is for tickets about the DBD-mysql CPAN distribution.

Report information
The Basics
Id: 97570
Status: resolved
Priority: 0/
Queue: DBD-mysql

People
Owner: Nobody in particular
Requestors: RURBAN [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 4.028



Subject: [patch] wrong salloc free in mysql_st_internal_execute
When you execute a statement without binding params, salloc in mysql_st_internal_execute will be NULL parse_params: if (!num_params) return NULL but then at line 3317 Safefree(salloc); is used unconditionally, trying to free NULL, which leads to a malloc assertion if you are lucky. patch see pull request -- Reini Urban
On Mon Jul 28 16:24:04 2014, RURBAN wrote: Show quoted text
> When you execute a statement without binding params, > salloc in mysql_st_internal_execute will be NULL > > parse_params: > if (!num_params) return NULL > > but then at line 3317 > Safefree(salloc); > > is used unconditionally, trying to free NULL, which leads to a malloc > assertion if you are lucky. > > patch see pull request
https://github.com/perl5-dbi/DBD-mysql/pull/25 --- dbdimp.c +++ dbdimp.c @@ -3314,7 +3314,8 @@ my_ulonglong mysql_st_internal_execute( } #endif - Safefree(salloc); + if (salloc) + Safefree(salloc); if(rows == -2) { do_error(h, mysql_errno(svsock), mysql_error(svsock), -- Reini Urban
On Mon Jul 28 16:24:04 2014, RURBAN wrote: Show quoted text
> When you execute a statement without binding params, > salloc in mysql_st_internal_execute will be NULL > > parse_params: > if (!num_params) return NULL > > but then at line 3317 > Safefree(salloc); > > is used unconditionally, trying to free NULL, which leads to a malloc > assertion if you are lucky.
You will probably mention that free(NULL) is legal in most libc's, but Safefree is not always using free directly and it crashes on our centos5 32-bit systems.
Thanks a lot for the fix, This was part of release 4.028.