Module: wine Branch: master Commit: 2689b5a3553c06119db1f9b02809675365e972bd URL: http://source.winehq.org/git/wine.git/?a=commit;h=2689b5a3553c06119db1f9b028...
Author: Ken Thomases ken@codeweavers.com Date: Wed Feb 7 10:11:52 2007 -0600
explorer: Fix leak: always release the CFDictionary.
---
programs/explorer/diskarb.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/programs/explorer/diskarb.c b/programs/explorer/diskarb.c index 637d983..08a8097 100644 --- a/programs/explorer/diskarb.c +++ b/programs/explorer/diskarb.c @@ -53,10 +53,10 @@ static void appeared_callback( DADiskRef
/* ignore non-removable devices */ if (!(ref = CFDictionaryGetValue( dict, CFSTR("DAMediaRemovable") )) || - !CFBooleanGetValue( ref )) return; + !CFBooleanGetValue( ref )) goto done;
/* get device name */ - if (!(ref = CFDictionaryGetValue( dict, CFSTR("DAMediaBSDName") ))) return; + if (!(ref = CFDictionaryGetValue( dict, CFSTR("DAMediaBSDName") ))) goto done; strcpy( device, "/dev/r" ); CFStringGetCString( ref, device + 6, sizeof(device) - 6, kCFStringEncodingASCII );
@@ -75,6 +75,7 @@ static void appeared_callback( DADiskRef WINE_TRACE( "got mount notification for '%s' on '%s'\n", device, mount_point );
add_dos_device( device, device, mount_point, type ); +done: CFRelease( dict ); }
@@ -93,16 +94,17 @@ static void disappeared_callback( DADisk
/* ignore non-removable devices */ if (!(ref = CFDictionaryGetValue( dict, CFSTR("DAMediaRemovable") )) || - !CFBooleanGetValue( ref )) return; + !CFBooleanGetValue( ref )) goto done;
/* get device name */ - if (!(ref = CFDictionaryGetValue( dict, CFSTR("DAMediaBSDName") ))) return; + if (!(ref = CFDictionaryGetValue( dict, CFSTR("DAMediaBSDName") ))) goto done; strcpy( device, "/dev/r" ); CFStringGetCString( ref, device + 6, sizeof(device) - 6, kCFStringEncodingASCII );
WINE_TRACE( "got unmount notification for '%s'\n", device );
remove_dos_device( device ); +done: CFRelease( dict ); }