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
Download (untitled) / with headers
text/plain 332b
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
Download (untitled) / with headers
text/plain 694b
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
Download (untitled) / with headers
text/plain 515b
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.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.