• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Puzzling Analyzer output
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Puzzling Analyzer output


  • Subject: Puzzling Analyzer output
  • From: Matt Gough <email@hidden>
  • Date: Thu, 1 Apr 2010 10:56:50 +0100

When running the analyzer on my app, I get the following warning:

warning: Object with +0 retain counts returned to caller where a +1 (owning) retain count is expected
     return data;
     ^

in the following method

- (NSData*) dataNoCopyForColumnIndex:(int)columnIdx {

    if (sqlite3_column_type(statement.statement, columnIdx) == SQLITE_NULL || (columnIdx < 0)) {
		return nil;
	}

    int dataSize = sqlite3_column_bytes(statement.statement, columnIdx);

    NSData *data = [NSData dataWithBytesNoCopy:(void *)sqlite3_column_blob(statement.statement, columnIdx) length:(NSUInteger)dataSize freeWhenDone:NO];

    return data;
}


I can't see anything wrong with the code, and its a common enough pattern to return autoreleased objects.

Is this just a false positive, or is there something obscure I am overlooking related to the NoCopy version of dataWithBytes?


Thanks

Matt _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Puzzling Analyzer output
      • From: Fritz Anderson <email@hidden>
    • Re: Puzzling Analyzer output
      • From: Ralf Schuchardt <email@hidden>
  • Prev by Date: No function names in Instruments Stack Trace?
  • Next by Date: Inline symbols visibility
  • Previous by thread: No function names in Instruments Stack Trace?
  • Next by thread: Re: Puzzling Analyzer output
  • Index(es):
    • Date
    • Thread