Skip to content

[PATCH] Memory leak in RMySQL 0.6-0

3 messages · Jeffrey Horner

#
Hi David,

I hope I'm working on the latest version of RMySQL...

I found a memory leak in RMySQL 0.6-0 for calls to mysqlExecStatement 
that return a result set. The fix is quite simple and is attached.

Jeff
#
Jeffrey Horner wrote on 10/08/2007 04:28 PM:
Oops, it would help if I attached the appropriate patch file. This one 
should be right.

Jeff
#
Jeffrey Horner wrote on 10/08/2007 04:35 PM:
Just a follow-up, but there seems to be another memory leak. This time 
it's in the libmysqlclient c library call load_defaults() (at least the 
one provided by my ubuntu distro). Each time a new RMySQL connection is 
made, load_defaults() is called. Another tidbit is that function doesn't 
seem to be part of the mysql client API according to this mysql bug report:

http://bugs.mysql.com/bug.php?id=25535

But all is not lost. The leak can be avoided by compiling RMySQL without 
getopt long support, but since most linux distros provide getopt, it's 
just as easy to edit line 348 of RS-MySQL.c (part of the RMySQL package) 
to look like this:

#if 0 /* HAVE_GETOPT_LONG */


Not sure what the maintainer wants to do about this one.

Jeff