leaked ODBC statement handles

Lionel Elie Mamane lionel at mamane.lu
Tue Jul 17 10:08:46 PDT 2012


On Mon, Jul 16, 2012 at 10:15:02PM -0400, Terrence Enger wrote:

> I am chasing some "leaked" ODBC statement handles.

> I see that ODatabaseMetaDataResultSet.cxx takes care *not* to free a
> statement handle which has not been subjected to one of 13 member
> functions with names starting "open...".  Questions arising ...

That is a bug. For the history, look at commit
aa3f42832756b7165a0722b2d013a572acf224c8
http://cgit.freedesktop.org/libreoffice/core/commit/?id=aa3f42832756b7165a0722b2d013a572acf224c8

Before that commit the statement handle was passed to the constructor;
the class had not allocated the handle, and thus it was not the
class's role to free it .... (I guess) unless it had taken ownership
of it by actually using it. I'm muddy on how the calling code was
supposed to "know" it should free it "because
ODatabaseMetaDataResultSet did not use it" or it was supposed *not* to
free it "because ODBMetaDataRS used it"; I can easily believe the code
was leaking statement handles in this way even back then (or
double-freeing them or whatever).

Anyway, since this commit, the handle is allocated privately "fresh"
by the class, and it should thus unconditionally free it on dispose;
m_bFreeHandle should die.

To you the honours of writing the patch? Put me as a reviewer, I'll
apply it.

-- 
Lionel


More information about the LibreOffice mailing list