Index: CLAM/src/Tools/AudioIO/Linux/ALSAAudioDevice.cxx
===================================================================
--- CLAM/src/Tools/AudioIO/Linux/ALSAAudioDevice.cxx	(revision 9985)
+++ CLAM/src/Tools/AudioIO/Linux/ALSAAudioDevice.cxx	(working copy)
@@ -278,7 +278,6 @@
 		ALSAAudioDeviceList()
 			:AudioDeviceList(std::string("alsa"))
 		{
-			std::stringstream name;
 			int card, dev;
 			snd_ctl_t *handle;
 			snd_ctl_card_info_t *info;
@@ -288,8 +287,10 @@
 			if (snd_card_next(&card) < 0 || card < 0)
 				return; // No cards found
 			while (card >= 0) {
-				name << "hw:" << card;
-				if (snd_ctl_open(&handle, name.str().c_str(), 0) < 0)
+				std::stringstream namestr;
+				namestr << "hw:" << card;
+				std::string name(namestr.str());
+				if (snd_ctl_open(&handle, name.c_str(), 0) < 0)
 					continue; // Card control open error!
 				if (snd_ctl_card_info(handle, info) < 0) {
 					snd_ctl_close(handle); // Card control read error!
@@ -300,12 +301,14 @@
 					snd_ctl_pcm_next_device(handle, &dev);
 					if (dev < 0)
 						break;
-					name << "," << dev;
-					mAvailableDevices.push_back(name.str());
+					std::stringstream dnamestr;
+					dnamestr << name << "," << dev;
+					std::string dname(dnamestr.str());
+					mAvailableDevices.push_back(dname.c_str());
 
-					name.clear();
-					name << "plughw:" << card << "," << dev;
-					mAvailableDevices.push_back(name.str());
+					std::stringstream plug;
+					plug << "plug" << dname;
+					mAvailableDevices.push_back(plug.str());
 				}
 				snd_ctl_close(handle);
 				if (snd_card_next(&card) < 0)
Index: CLAM/src/Tools/MIDIIO/Linux/ALSAMIDIDevice.cxx
===================================================================
--- CLAM/src/Tools/MIDIIO/Linux/ALSAMIDIDevice.cxx	(revision 9985)
+++ CLAM/src/Tools/MIDIIO/Linux/ALSAMIDIDevice.cxx	(working copy)
@@ -122,7 +122,6 @@
 		ALSAMIDIDeviceList()
 			:MIDIDeviceList(std::string("alsa"))
 		{
-			std::stringstream name;
 			int card, dev;
 			snd_ctl_t *handle;
 			snd_ctl_card_info_t *info;
@@ -132,9 +131,12 @@
 			if (snd_card_next(&card) < 0 || card < 0)
 				return; // No cards found
 			while (card >= 0) {
-				name << "hw:" << card;	
-				if (snd_ctl_open(&handle, name.str().c_str(), 0) < 0)
+				std::stringstream namestr;
+				namestr << "hw:" << card;	
+				std::string name(namestr.str());
+				if (snd_ctl_open(&handle, name.c_str(), 0) < 0)
 					continue; // Card control open error!
+
 				if (snd_ctl_card_info(handle, info) < 0) {
 					snd_ctl_close(handle); // Card control read error!
 					continue;
@@ -144,8 +146,9 @@
 					snd_ctl_rawmidi_next_device(handle, &dev);
 					if (dev < 0)
 						break;
-					name << "," << dev;
-					mAvailableDevices.push_back(name.str());
+					std::stringstream dname;
+					dname << name << "," << dev;
+					mAvailableDevices.push_back(dname.str());
 				}
 				snd_ctl_close(handle);
 				if (snd_card_next(&card) < 0)
