diff options
| author | Gary Scavone <gary@music.mcgill.ca> | 2013-12-28 08:38:15 -0800 |
|---|---|---|
| committer | Gary Scavone <gary@music.mcgill.ca> | 2013-12-28 08:38:15 -0800 |
| commit | 9d0703f03ac2972409816f147e2141b3fe315a54 (patch) | |
| tree | bbb8d716081eb35e19a252d51021dc8c330db775 /RtAudio.cpp | |
| parent | a4f8006d958d592cc17ca8b08f5fc2d93ae0e9be (diff) | |
A few small memory leak fixes from MK
Diffstat (limited to 'RtAudio.cpp')
| -rw-r--r-- | RtAudio.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/RtAudio.cpp b/RtAudio.cpp index 1562e85..f9259df 100644 --- a/RtAudio.cpp +++ b/RtAudio.cpp @@ -5358,6 +5358,8 @@ RtAudio::DeviceInfo RtApiAlsa :: getDeviceInfo( unsigned int device ) goto probeParameters;
}
}
+ else
+ snd_ctl_close( chandle );
result = snd_pcm_open( &phandle, name, stream, openMode | SND_PCM_NONBLOCK);
if ( result < 0 ) {
@@ -5470,6 +5472,7 @@ RtAudio::DeviceInfo RtApiAlsa :: getDeviceInfo( unsigned int device ) // Check that we have at least one supported format
if ( info.nativeFormats == 0 ) {
+ snd_pcm_close( phandle );
errorStream_ << "RtApiAlsa::getDeviceInfo: pcm device (" << name << ") data format not supported by RtAudio.";
errorText_ = errorStream_.str();
error( RtAudioError::WARNING );
@@ -5479,8 +5482,10 @@ RtAudio::DeviceInfo RtApiAlsa :: getDeviceInfo( unsigned int device ) // Get the device name
char *cardname;
result = snd_card_get_name( card, &cardname );
- if ( result >= 0 )
+ if ( result >= 0 ) {
sprintf( name, "hw:%s,%d", cardname, subdevice );
+ free( cardname );
+ }
info.name = name;
// That's all ... close the device and return
|
