diff --git a/indra/llaudio/llaudiodecodemgr.cpp b/indra/llaudio/llaudiodecodemgr.cpp
index 77e57b14f5d05d0979ff965cd95456422dfb4780..6ab61689fd0532a8f67c65576ed2cd0c7bfcda94 100644
--- a/indra/llaudio/llaudiodecodemgr.cpp
+++ b/indra/llaudio/llaudiodecodemgr.cpp
@@ -265,9 +265,19 @@ BOOL LLVorbisDecodeState::initDecode()
 		mInFilep = NULL;
 		return FALSE;
 	}
-	
-	mWAVBuffer.reserve(size_guess);
-	mWAVBuffer.resize(WAV_HEADER_SIZE);
+
+	try
+	{
+		mWAVBuffer.reserve(size_guess);
+		mWAVBuffer.resize(WAV_HEADER_SIZE);
+	}
+	catch (std::bad_alloc)
+	{
+		LL_WARNS("AudioEngine") << "Out of memory when trying to alloc buffer: " << size_guess << LL_ENDL;
+		delete mInFilep;
+		mInFilep = NULL;
+		return FALSE;
+	}
 
 	{
 		// write the .wav format header