BugsBiteBugs / sqlitepersistentobjects

Automatically exported from code.google.com/p/sqlitepersistentobjects
0 stars 0 forks source link

Leak in +[NSNumber objectWithSqlColumnRepresentation] #35

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What version of the product are you using? On what operating system?
On iPhone OS and Mac OS without GC-enabled the following leaks:

if (doubleValue == longValue)
        self = [[NSNumber alloc] initWithLongLong:longValue];
    else
        self = [[NSNumber alloc] initWithDouble:doubleValue];

Please provide any additional information below.

these should be autoreleased explicitly or should be -[NSNumber 
numberWithLongLong] and -
[NSNumber numberWithDouble] respectively

Original issue reported on code.google.com by j.p.dann on 23 Jan 2009 at 2:41

GoogleCodeExporter commented 9 years ago
Also, you shouldn't be assigning the result of the number creation to self. 
This has no real meaning as self, in 
this context, is the NSNumber class. In this method you're creating a new 
autoreleased instance of NSNumber. 
Which should be:

NSNumber *number = nil;
if ( /*...*/)
  number = [self numberWithLongLong:longValue];
else
  number = [self numberWithDouble:doubleValue];
return number;

Original comment by j.p.dann on 23 Jan 2009 at 3:01

GoogleCodeExporter commented 9 years ago
Thanks, I have incorporated the fix into the codeline.

Original comment by jeff.lam...@gmail.com on 19 Feb 2009 at 1:24

GoogleCodeExporter commented 9 years ago
If nobody has any objections, I think we can mark this as fixed.

Original comment by ScottALyons on 14 Mar 2009 at 3:32

GoogleCodeExporter commented 9 years ago
Yep, thanks for fixing that one Jeff :)

Original comment by j.p.dann on 15 Mar 2009 at 1:19