I am working with the MySql++ 1.7.9 on windows98 using borland C++ 6.0.
I have found and fixed a memory leak ( applicable on all platforms that need
the __USLC__ conditional defined) , and sucessfully ported the system to
borlanbd C++ 6 with a very minimum of modifications. (mostly resolving
include file differences between compilers). I would be willing to submit
the port back to mysql, but i am not sure who to contact about it.
The memory leak is in the function string SQLQuery::str(const SQLQueryParms
&p) const, starting on line 98 of sql_query.cpp (.cc ? I may have changed
the extentions.) This is the fixed function:
string SQLQuery::str(const SQLQueryParms &p) const {
SQLQuery *const_this = const_cast<SQLQuery *>(this);
if (!parsed.empty()) const_this->proc(const_cast<SQLQueryParms&>(p));
*const_this << ends;
#ifdef __USLC__
strstreambuf *tmpbuf = const_this->rdbuf();
uint length = tmpbuf->pcount() + 1;
char *s = new char[length];//isnt this a memory leak?
#else
uint length = const_this->pcount() + 1;
char s[length];
#endif
const_this->get(s, length, '\0');
const_this->seekg (0,ios::beg);
const_this->seekp (-1,ios::cur);
//fixed leak for conditional __USLC__ er 4/3/2002
/*
*original code
*
return string(s);
*/
/*
*new code
*/
#ifdef __USLC__
string tmp(s);
delete s;
return tmp;
#else
return string(s);
#endif
/*
* end mod
***/
}
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php