mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-15 04:54:46 +00:00
explorer: Fix leak: always release the CFDictionary.
This commit is contained in:
parent
d19a789fa2
commit
2689b5a355
|
@ -53,10 +53,10 @@ static void appeared_callback( DADiskRef disk, void *context )
|
||||||
|
|
||||||
/* ignore non-removable devices */
|
/* ignore non-removable devices */
|
||||||
if (!(ref = CFDictionaryGetValue( dict, CFSTR("DAMediaRemovable") )) ||
|
if (!(ref = CFDictionaryGetValue( dict, CFSTR("DAMediaRemovable") )) ||
|
||||||
!CFBooleanGetValue( ref )) return;
|
!CFBooleanGetValue( ref )) goto done;
|
||||||
|
|
||||||
/* get device name */
|
/* get device name */
|
||||||
if (!(ref = CFDictionaryGetValue( dict, CFSTR("DAMediaBSDName") ))) return;
|
if (!(ref = CFDictionaryGetValue( dict, CFSTR("DAMediaBSDName") ))) goto done;
|
||||||
strcpy( device, "/dev/r" );
|
strcpy( device, "/dev/r" );
|
||||||
CFStringGetCString( ref, device + 6, sizeof(device) - 6, kCFStringEncodingASCII );
|
CFStringGetCString( ref, device + 6, sizeof(device) - 6, kCFStringEncodingASCII );
|
||||||
|
|
||||||
|
@ -75,6 +75,7 @@ static void appeared_callback( DADiskRef disk, void *context )
|
||||||
WINE_TRACE( "got mount notification for '%s' on '%s'\n", device, mount_point );
|
WINE_TRACE( "got mount notification for '%s' on '%s'\n", device, mount_point );
|
||||||
|
|
||||||
add_dos_device( device, device, mount_point, type );
|
add_dos_device( device, device, mount_point, type );
|
||||||
|
done:
|
||||||
CFRelease( dict );
|
CFRelease( dict );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,16 +94,17 @@ static void disappeared_callback( DADiskRef disk, void *context )
|
||||||
|
|
||||||
/* ignore non-removable devices */
|
/* ignore non-removable devices */
|
||||||
if (!(ref = CFDictionaryGetValue( dict, CFSTR("DAMediaRemovable") )) ||
|
if (!(ref = CFDictionaryGetValue( dict, CFSTR("DAMediaRemovable") )) ||
|
||||||
!CFBooleanGetValue( ref )) return;
|
!CFBooleanGetValue( ref )) goto done;
|
||||||
|
|
||||||
/* get device name */
|
/* get device name */
|
||||||
if (!(ref = CFDictionaryGetValue( dict, CFSTR("DAMediaBSDName") ))) return;
|
if (!(ref = CFDictionaryGetValue( dict, CFSTR("DAMediaBSDName") ))) goto done;
|
||||||
strcpy( device, "/dev/r" );
|
strcpy( device, "/dev/r" );
|
||||||
CFStringGetCString( ref, device + 6, sizeof(device) - 6, kCFStringEncodingASCII );
|
CFStringGetCString( ref, device + 6, sizeof(device) - 6, kCFStringEncodingASCII );
|
||||||
|
|
||||||
WINE_TRACE( "got unmount notification for '%s'\n", device );
|
WINE_TRACE( "got unmount notification for '%s'\n", device );
|
||||||
|
|
||||||
remove_dos_device( device );
|
remove_dos_device( device );
|
||||||
|
done:
|
||||||
CFRelease( dict );
|
CFRelease( dict );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue