crash in DBD::mysql/ statement leak in DBD::mysql

Rainer Weikusat <[email protected]> Mon, 21 May 2007 12:59:07 +0200
Newsgroups gmane.comp.db.mysql.perl
Message-ID <[email protected]>
This applies to the current CPAN-version of the DBD::mysql module.

When using server side prepared statements, storage for 'bind values'
is allocated in dbd_st_prepare and freed in dbd_st_finish after all
rows resulting from one execution of a query have been fetched. This
means the next attempt to execute the prepared statement will
segfault when trying to use those storage.

Fix for this issue: Move the freeing-code to the dbd_st_destroy
routine. 

Additionally, the person who delete the 'free everything' code from
dbd_st_destroy accidentally deleted the once line of code that was
different from the similar chunk in dbd_st_finish, namely, the
mysql_stmt_close call, meaning, prepared statements are leaked in the
server.

Fix for this issue: Re-add mysql_stmt_close in dbd_st_destroy.

The attached patch does both of this.

NB: Both of this issues have already been reported as bugs, but
apparently, the responsible person believed that the first doesn't
actually exist and for the second, a patch has been proposed which
would make the thing worse (calling mysql_stmt_close in finish will
prevent re-executing prepared select statements after all results of
one execution have been fetched). Additionally, the patch implements
only the two fixes and not a larger set of 'random other changes',
like the one for #1 available from the Mysql-BTS did.


-- 
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe:    http://lists.mysql.com/[email protected]
patch (application/octet-stream, 2.1 KB) - not displayed