Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: base/mac/foundation_util.mm

Issue 8513019: Valgrind: Fix a leak in GetValueFromDictionary for cocoa. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/mac/foundation_util.h" 5 #include "base/mac/foundation_util.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 } 231 }
232 232
233 CFTypeRef GetValueFromDictionary(CFDictionaryRef dict, 233 CFTypeRef GetValueFromDictionary(CFDictionaryRef dict,
234 CFStringRef key, 234 CFStringRef key,
235 CFTypeID expected_type) { 235 CFTypeID expected_type) {
236 CFTypeRef value = CFDictionaryGetValue(dict, key); 236 CFTypeRef value = CFDictionaryGetValue(dict, key);
237 if (!value) 237 if (!value)
238 return value; 238 return value;
239 239
240 if (CFGetTypeID(value) != expected_type) { 240 if (CFGetTypeID(value) != expected_type) {
241 std::string expected_type_name = base::SysCFStringRefToUTF8( 241 ScopedCFTypeRef<CFStringRef> expected_type_name(
242 CFCopyTypeIDDescription(expected_type)); 242 CFCopyTypeIDDescription(expected_type));
243 std::string expected_type_utf8 =
244 base::SysCFStringRefToUTF8(expected_type_name);
243 DLOG(WARNING) << GetValueFromDictionaryErrorMessage(key, 245 DLOG(WARNING) << GetValueFromDictionaryErrorMessage(key,
244 expected_type_name, 246 expected_type_utf8,
245 value); 247 value);
246 return NULL; 248 return NULL;
247 } 249 }
248 250
249 return value; 251 return value;
250 } 252 }
251 253
252 void NSObjectRetain(void* obj) { 254 void NSObjectRetain(void* obj) {
253 id<NSObject> nsobj = static_cast<id<NSObject> >(obj); 255 id<NSObject> nsobj = static_cast<id<NSObject> >(obj);
254 [nsobj retain]; 256 [nsobj retain];
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 CFDictionaryGetValue(user_info.get(), kCFErrorDescriptionKey)); 396 CFDictionaryGetValue(user_info.get(), kCFErrorDescriptionKey));
395 } 397 }
396 o << "Code: " << CFErrorGetCode(err) 398 o << "Code: " << CFErrorGetCode(err)
397 << " Domain: " << CFErrorGetDomain(err) 399 << " Domain: " << CFErrorGetDomain(err)
398 << " Desc: " << desc.get(); 400 << " Desc: " << desc.get();
399 if(errorDesc) { 401 if(errorDesc) {
400 o << "(" << errorDesc << ")"; 402 o << "(" << errorDesc << ")";
401 } 403 }
402 return o; 404 return o;
403 } 405 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698