mirror of
https://github.com/gnustep/libs-sqlclient.git
synced 2025-02-21 02:41:07 +00:00
Fix leak
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@40453 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
2e370c6341
commit
73a5f5576e
2 changed files with 27 additions and 3 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,8 +1,14 @@
|
||||||
|
2017-04-07 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* SQLClient.m:
|
||||||
|
Fix leak of SQLString instances caused by inheriting memory management
|
||||||
|
methods from the literal string class.
|
||||||
|
|
||||||
2017-03-06 Richard Frith-Macdonald <rfm@gnu.org>
|
2017-03-06 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
SQLClient.h:
|
* SQLClient.h:
|
||||||
SQLClient.m:
|
* SQLClient.m:
|
||||||
SQLClientPool.m:
|
* SQLClientPool.m:
|
||||||
Add new +literal: and -literal: methods to make a normal string into
|
Add new +literal: and -literal: methods to make a normal string into
|
||||||
one recognised as suitable for use literally (ie without quoting) in
|
one recognised as suitable for use literally (ie without quoting) in
|
||||||
an SQL query/statement.
|
an SQL query/statement.
|
||||||
|
|
18
SQLClient.m
18
SQLClient.m
|
@ -992,6 +992,8 @@ static int poolConnections = 0;
|
||||||
|
|
||||||
if (Nil == LitStringClass)
|
if (Nil == LitStringClass)
|
||||||
{
|
{
|
||||||
|
Class root = [NSObject class];
|
||||||
|
|
||||||
/* Find the literal string class used by the foundation library.
|
/* Find the literal string class used by the foundation library.
|
||||||
*/
|
*/
|
||||||
LitStringClass = object_getClass(@"test");
|
LitStringClass = object_getClass(@"test");
|
||||||
|
@ -1001,6 +1003,22 @@ static int poolConnections = 0;
|
||||||
SQLStringClass = (Class)objc_allocateClassPair(
|
SQLStringClass = (Class)objc_allocateClassPair(
|
||||||
LitStringClass, "SQLString", 0);
|
LitStringClass, "SQLString", 0);
|
||||||
objc_registerClassPair(SQLStringClass);
|
objc_registerClassPair(SQLStringClass);
|
||||||
|
|
||||||
|
/* The the NSObject memory management methods because the
|
||||||
|
* literal string doesn't get retained/released.
|
||||||
|
*/
|
||||||
|
class_replaceMethod(SQLStringClass, @selector(retain),
|
||||||
|
class_getMethodImplementation(root, @selector(retain)),
|
||||||
|
"@@:");
|
||||||
|
class_replaceMethod(SQLStringClass, @selector(autorelease),
|
||||||
|
class_getMethodImplementation(root, @selector(autorelease)),
|
||||||
|
"@@:");
|
||||||
|
class_replaceMethod(SQLStringClass, @selector(release),
|
||||||
|
class_getMethodImplementation(root, @selector(release)),
|
||||||
|
"v@:");
|
||||||
|
class_replaceMethod(SQLStringClass, @selector(dealloc),
|
||||||
|
class_getMethodImplementation(root, @selector(dealloc)),
|
||||||
|
"v@:");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nil == null)
|
if (nil == null)
|
||||||
|
|
Loading…
Reference in a new issue