summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary Scavone <gary@music.mcgill.ca>2013-12-28 08:38:15 -0800
committerGary Scavone <gary@music.mcgill.ca>2013-12-28 08:38:15 -0800
commit9d0703f03ac2972409816f147e2141b3fe315a54 (patch)
treebbb8d716081eb35e19a252d51021dc8c330db775
parenta4f8006d958d592cc17ca8b08f5fc2d93ae0e9be (diff)
A few small memory leak fixes from MK
-rw-r--r--RtAudio.cpp7
-rw-r--r--RtAudio.h5
2 files changed, 8 insertions, 4 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
diff --git a/RtAudio.h b/RtAudio.h
index 2be313d..d1fbd65 100644
--- a/RtAudio.h
+++ b/RtAudio.h
@@ -190,9 +190,8 @@ typedef int (*RtAudioCallback)( void *outputBuffer, void *inputBuffer,
\brief Exception handling class for RtAudio.
The RtAudioError class is quite simple but it does allow errors to be
- "caught" by RtAudioError::Type. See the RtAudio and RtMidi
- documentation to know which methods can throw an RtAudioError.
-
+ "caught" by RtAudioError::Type. See the RtAudio documentation to know
+ which methods can throw an RtAudioError.
*/
/************************************************************************/