While the content of the string/data is not managed by ref-counting, the CFStringRef and CFDataRef themselves still need to be released.
../../remoting/ios/persistence/remoting_keychain.cc:48:24: warning: Potential leak of an object
CFDictionarySetValue(dictionary.get(), kSecAttrAccount,
^
../../remoting/ios/persistence/remoting_keychain.cc:140:35: note: Calling 'CreateQueryForUpdate'
ScopedMutableDictionary query = CreateQueryForUpdate(service, account);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../remoting/ios/persistence/remoting_keychain.cc:47:24: note: Calling 'WrapStdString'
WrapStdString(service));
^~~~~~~~~~~~~~~~~~~~~~
../../remoting/ios/persistence/remoting_keychain.cc:25:10: note: Call to function 'CFStringCreateWithCStringNoCopy' returns a Core Foundation object of type CFStringRef with a +1 retain count
return CFStringCreateWithCStringNoCopy(kCFAllocatorDefault, str.c_str(),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../remoting/ios/persistence/remoting_keychain.cc:47:24: note: Returning from 'WrapStdString'
WrapStdString(service));
^~~~~~~~~~~~~~~~~~~~~~
../../remoting/ios/persistence/remoting_keychain.cc:48:24: note: Object leaked: allocated object is not referenced later in this execution path and has a retain count of +1
CFDictionarySetValue(dictionary.get(), kSecAttrAccount,
^~~~~~~~~~~~~~~~
../../remoting/ios/persistence/remoting_keychain.cc:51:10: warning: Potential leak of an object
return dictionary;
^
../../remoting/ios/persistence/remoting_keychain.cc:140:35: note: Calling 'CreateQueryForUpdate'
ScopedMutableDictionary query = CreateQueryForUpdate(service, account);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../remoting/ios/persistence/remoting_keychain.cc:49:24: note: Calling 'WrapStdString'
WrapStdString(account));
^~~~~~~~~~~~~~~~~~~~~~
../../remoting/ios/persistence/remoting_keychain.cc:25:10: note: Call to function 'CFStringCreateWithCStringNoCopy' returns a Core Foundation object of type CFStringRef with a +1 retain count
return CFStringCreateWithCStringNoCopy(kCFAllocatorDefault, str.c_str(),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../remoting/ios/persistence/remoting_keychain.cc:49:24: note: Returning from 'WrapStdString'
WrapStdString(account));
^~~~~~~~~~~~~~~~~~~~~~
../../remoting/ios/persistence/remoting_keychain.cc:51:10: note: Object leaked: allocated object is not referenced later in this execution path and has a retain count of +1
return dictionary;
^~~~~~~~~~
../../remoting/ios/persistence/remoting_keychain.cc:67:10: warning: Potential leak of an object
return dictionary;
^
../../remoting/ios/persistence/remoting_keychain.cc:90:7: note: Assuming the condition is false
if (!existing_data.empty()) {
^~~~~~~~~~~~~~~~~~~~~~
../../remoting/ios/persistence/remoting_keychain.cc:90:3: note: Taking false branch
if (!existing_data.empty()) {
^
../../remoting/ios/persistence/remoting_keychain.cc:109:7: note: Calling 'CreateDictionaryForInsertion'
CreateDictionaryForInsertion(service, account, data);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../remoting/ios/persistence/remoting_keychain.cc:66:57: note: Calling 'WrapStringToData'
CFDictionarySetValue(dictionary.get(), kSecValueData, WrapStringToData(data));
^~~~~~~~~~~~~~~~~~~~~~
../../remoting/ios/persistence/remoting_keychain.cc:32:10: note: Call to function 'CFDataCreateWithBytesNoCopy' returns a Core Foundation object of type CFDataRef with a +1 retain count
return CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, data_pointer,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../remoting/ios/persistence/remoting_keychain.cc:66:57: note: Returning from 'WrapStringToData'
CFDictionarySetValue(dictionary.get(), kSecValueData, WrapStringToData(data));
^~~~~~~~~~~~~~~~~~~~~~
../../remoting/ios/persistence/remoting_keychain.cc:67:10: note: Object leaked: allocated object is not referenced later in this execution path and has a retain count of +1
return dictionary;
^~~~~~~~~~
../../remoting/ios/persistence/remoting_keychain.cc:100:37: warning: Potential leak of an object
OSStatus status = SecItemUpdate(update_query, updated_attributes);
^~~~~~~~~~~~
../../remoting/ios/persistence/remoting_keychain.cc:90:7: note: Assuming the condition is true
if (!existing_data.empty()) {
^~~~~~~~~~~~~~~~~~~~~~
../../remoting/ios/persistence/remoting_keychain.cc:90:3: note: Taking true branch
if (!existing_data.empty()) {
^
../../remoting/ios/persistence/remoting_keychain.cc:99:26: note: Calling 'WrapStringToData'
WrapStringToData(data));
^~~~~~~~~~~~~~~~~~~~~~
../../remoting/ios/persistence/remoting_keychain.cc:32:10: note: Call to function 'CFDataCreateWithBytesNoCopy' returns a Core Foundation object of type CFDataRef with a +1 retain count
return CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, data_pointer,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../remoting/ios/persistence/remoting_keychain.cc:99:26: note: Returning from 'WrapStringToData'
WrapStringToData(data));
^~~~~~~~~~~~~~~~~~~~~~
../../remoting/ios/persistence/remoting_keychain.cc:100:37: note: Object leaked: allocated object is not referenced later in this execution path and has a retain count of +1
OSStatus status = SecItemUpdate(update_query, updated_attributes);
^~~~~~~~~~~~
4 warnings generated.
Comment 1 by bugdroid1@chromium.org
, Apr 17 2018