diff --git a/indra/llcommon/llallocator_heap_profile.cpp b/indra/llcommon/llallocator_heap_profile.cpp
index 0a807702d0a92fbafc805a622efef16bfe2834a0..e50d59fd4b6eb1fc04ebce0e16021710312c0de5 100644
--- a/indra/llcommon/llallocator_heap_profile.cpp
+++ b/indra/llcommon/llallocator_heap_profile.cpp
@@ -113,21 +113,24 @@ void LLAllocatorHeapProfile::parse(std::string const & prof_text)
         ++j;
 
         while(j != line_elems.end() && j->empty()) { ++j; } // skip any separator tokens
-        llassert_always(j != line_elems.end());
-        ++j; // skip the '@'
-
-        mLines.push_back(line(live_count, live_size, tot_count, tot_size));
-        line & current_line = mLines.back();
-
-        for(; j != line_elems.end(); ++j)
-        {
-            if(!j->empty()) {
-                U32 marker = boost::lexical_cast<U32>(*j);
-                current_line.mTrace.push_back(marker);
-            }
-        }
+	llassert(j != line_elems.end());
+        if (j != line_elems.end())
+	{
+		++j; // skip the '@'
+
+		mLines.push_back(line(live_count, live_size, tot_count, tot_size));
+		line & current_line = mLines.back();
+		
+		for(; j != line_elems.end(); ++j)
+		{
+			if(!j->empty())
+			{
+				U32 marker = boost::lexical_cast<U32>(*j);
+				current_line.mTrace.push_back(marker);
+			}
+		}
+	}
     }
-
     // *TODO - parse MAPPED_LIBRARIES section here if we're ever interested in it
 }
 
diff --git a/indra/llcommon/lldate.cpp b/indra/llcommon/lldate.cpp
index ca7e471bf253d83dee384b2c6e8d47187c63bbdd..de7f2ead74e9774ba86d4a64fe924b9844e0fab7 100644
--- a/indra/llcommon/lldate.cpp
+++ b/indra/llcommon/lldate.cpp
@@ -152,7 +152,8 @@ void LLDate::toStream(std::ostream& s) const
 		s << '.' << std::setw(2)
 		  << (int)(exp_time.tm_usec / (LL_APR_USEC_PER_SEC / 100));
 	}
-	s << 'Z';
+	s << 'Z'
+	  << std::setfill(' ');
 }
 
 bool LLDate::split(S32 *year, S32 *month, S32 *day, S32 *hour, S32 *min, S32 *sec) const
diff --git a/indra/llcommon/llprocessor.cpp b/indra/llcommon/llprocessor.cpp
index 469e544b16f7f2ded252f8fbf8cfd6f5efda077f..8a4a4a8f9afd55a535a9c0878d18b8974b6a5d38 100644
--- a/indra/llcommon/llprocessor.cpp
+++ b/indra/llcommon/llprocessor.cpp
@@ -281,7 +281,8 @@ bool CProcessor::AnalyzeIntelProcessor()
 	// already have a string here from GetCPUInfo().  JC
 	if ( CPUInfo.uiBrandID < LL_ARRAY_SIZE(INTEL_BRAND) )
 	{
-		strcpy(CPUInfo.strBrandID, INTEL_BRAND[CPUInfo.uiBrandID]);
+		strncpy(CPUInfo.strBrandID, INTEL_BRAND[CPUInfo.uiBrandID], sizeof(CPUInfo.strBrandID)-1);
+		CPUInfo.strBrandID[sizeof(CPUInfo.strBrandID)-1]='\0';
 
 		if (CPUInfo.uiBrandID == 3 && CPUInfo.uiModel == 6)
 		{
diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h
index 31e70e0fe4d950989d3de39ae10991f9cc5bdf38..62cedcde4e4688bd7015beb0d3c260e1e634a47f 100644
--- a/indra/llcommon/llstring.h
+++ b/indra/llcommon/llstring.h
@@ -882,6 +882,7 @@ void LLStringUtilBase<T>::addCRLF(std::basic_string<T>& string)
 		}
 
 		string.assign(t, size);
+		delete[] t;
 	}
 }
 
diff --git a/indra/llcommon/lluri.cpp b/indra/llcommon/lluri.cpp
index f6e8f01f0ef2b84cc4f44ef5e2b36aa332813978..9d4f3a98f04668a41a7940353097322c9115191d 100644
--- a/indra/llcommon/lluri.cpp
+++ b/indra/llcommon/lluri.cpp
@@ -46,10 +46,21 @@
 
 void encode_character(std::ostream& ostr, std::string::value_type val)
 {
-	ostr << "%" << std::uppercase << std::hex << std::setw(2) << std::setfill('0') 
+	ostr << "%"
+
+	     << std::uppercase
+	     << std::hex
+	     << std::setw(2)
+	     << std::setfill('0') 
+
 	     // VWR-4010 Cannot cast to U32 because sign-extension on 
 	     // chars > 128 will result in FFFFFFC3 instead of F3.
-	     << static_cast<S32>(static_cast<U8>(val));
+	     << static_cast<S32>(static_cast<U8>(val))
+
+		// reset stream state
+	     << std::nouppercase
+	     << std::dec
+	     << std::setfill(' ');
 }
 
 // static
diff --git a/indra/llmath/lloctree.h b/indra/llmath/lloctree.h
index ba8776690a3b2c3c03f7c531aafb9c23c7a1c33e..2f34fb1bb047181df7aa875b71c982e06208b227 100644
--- a/indra/llmath/lloctree.h
+++ b/indra/llmath/lloctree.h
@@ -183,7 +183,6 @@ class LLOctreeNode : public LLTreeNode<T>
 		{
 			mMax.mdV[i] = mCenter.mdV[i] + mSize.mdV[i];
 			mMin.mdV[i] = mCenter.mdV[i] - mSize.mdV[i];
-			mCenter.mdV[i] = mCenter.mdV[i];
 		}
 	}
 
diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp
index 3078d80552b19fca1df4074f932c8340f6465aa1..dbec2816c840e78a0da8806784a612f6a133a0d4 100644
--- a/indra/llmessage/llcachename.cpp
+++ b/indra/llmessage/llcachename.cpp
@@ -125,7 +125,7 @@ class ReplySender
 };
 
 ReplySender::ReplySender(LLMessageSystem* msg)
-	: mMsg(msg), mPending(false)
+	: mMsg(msg), mPending(false), mCurrIsGroup(false)
 { }
 
 ReplySender::~ReplySender()
diff --git a/indra/llmessage/llmessagetemplateparser.cpp b/indra/llmessage/llmessagetemplateparser.cpp
index 283547ea009dbde38d208e400b96930e6822fb38..2ddbf3e0df077f1b148f817698919e16a92dd34f 100644
--- a/indra/llmessage/llmessagetemplateparser.cpp
+++ b/indra/llmessage/llmessagetemplateparser.cpp
@@ -403,6 +403,10 @@ LLTemplateParser::LLTemplateParser(LLTemplateTokenizer & tokens):
 		{
 			mMessages.push_back(templatep);
 		}
+		else
+		{
+			delete templatep;
+		}
 	}
 
 	if(!tokens.wantEOF())
diff --git a/indra/llmessage/llnamevalue.cpp b/indra/llmessage/llnamevalue.cpp
index 01e922eba247280176fdcf189f354a9f914f9c6b..43429b0ab375c5fc4d86569a0aab20827a2770a9 100644
--- a/indra/llmessage/llnamevalue.cpp
+++ b/indra/llmessage/llnamevalue.cpp
@@ -963,6 +963,7 @@ std::ostream&		operator<<(std::ostream& s, const LLNameValue &a)
 			U64_to_str(*a.mNameValueReference.u64, u64_string, sizeof(u64_string));
 			s << u64_string;
 		}
+		break;
 	case NVT_VEC3:
 		s << *(a.mNameValueReference.vec3);
 		break;
diff --git a/indra/llmessage/lltemplatemessagebuilder.cpp b/indra/llmessage/lltemplatemessagebuilder.cpp
index 6400310c4656ba6613cfc38039a10be474cf5b97..55379fc6fdcb6beaa487191899b153410b3ef813 100644
--- a/indra/llmessage/lltemplatemessagebuilder.cpp
+++ b/indra/llmessage/lltemplatemessagebuilder.cpp
@@ -737,10 +737,14 @@ static S32 buildBlock(U8* buffer, S32 buffer_size, const LLMessageBlock* templat
 		}
 
 		--block_count;
-		++block_iter;
+		
 		if (block_iter != message_data->mMemberBlocks.end())
 		{
-			mbci = block_iter->second;
+			++block_iter;
+			if (block_iter != message_data->mMemberBlocks.end())
+			{
+				mbci = block_iter->second;
+			}
 		}
 	}
 
diff --git a/indra/llmessage/lltransfermanager.cpp b/indra/llmessage/lltransfermanager.cpp
index d67911e8e2a3c414b010c687695e77f2b9074703..0a71ad95f2b4fa0b780ddaaad81ea8c7d0db00ff 100644
--- a/indra/llmessage/lltransfermanager.cpp
+++ b/indra/llmessage/lltransfermanager.cpp
@@ -855,6 +855,7 @@ void LLTransferSourceChannel::updateTransfers()
 			break;
 		case LLTS_ERROR:
 			llwarns << "Error in transfer dataCallback!" << llendl;
+			// fall through
 		case LLTS_DONE:
 			// We need to clean up this transfer source.
 			//llinfos << "LLTransferSourceChannel::updateTransfers() " << tsp->getID() << " done" << llendl;
diff --git a/indra/llplugin/llpluginprocesschild.cpp b/indra/llplugin/llpluginprocesschild.cpp
index 07fc82c770f544f399a2bfbce51b5e9c682a3ba6..11c924cadfd5a7fc3f7ba670d312385f5cec0157 100644
--- a/indra/llplugin/llpluginprocesschild.cpp
+++ b/indra/llplugin/llpluginprocesschild.cpp
@@ -359,6 +359,7 @@ void LLPluginProcessChild::receiveMessageRaw(const std::string &message)
 					else
 					{
 						LL_WARNS("Plugin") << "Couldn't create a shared memory segment!" << LL_ENDL;
+						delete region;
 					}
 				}
 				
diff --git a/indra/llplugin/slplugin/slplugin.cpp b/indra/llplugin/slplugin/slplugin.cpp
index 23dc532ba56eeeec47d1e4691cf160cbea886a05..77240ce5468f6bc09d7957e0982acb8764ded397 100644
--- a/indra/llplugin/slplugin/slplugin.cpp
+++ b/indra/llplugin/slplugin/slplugin.cpp
@@ -156,7 +156,7 @@ bool checkExceptionHandler()
 	if (prev_filter == NULL)
 	{
 		ok = FALSE;
-		if (myWin32ExceptionHandler == NULL)
+		if (NULL == myWin32ExceptionHandler)
 		{
 			LL_WARNS("AppInit") << "Exception handler uninitialized." << LL_ENDL;
 		}
diff --git a/indra/llrender/llfontbitmapcache.cpp b/indra/llrender/llfontbitmapcache.cpp
index f01878642a45eb896b54d4220e03e4d06aaa51e5..fa231c9e6ad5e50d30c9476573035644a2b1b6f5 100644
--- a/indra/llrender/llfontbitmapcache.cpp
+++ b/indra/llrender/llfontbitmapcache.cpp
@@ -64,7 +64,7 @@ void LLFontBitmapCache::init(S32 num_components,
 
 LLImageRaw *LLFontBitmapCache::getImageRaw(U32 bitmap_num) const
 {
-	if ((bitmap_num < 0) || (bitmap_num >= mImageRawVec.size()))
+	if (bitmap_num >= mImageRawVec.size())
 		return NULL;
 
 	return mImageRawVec[bitmap_num];
@@ -72,7 +72,7 @@ LLImageRaw *LLFontBitmapCache::getImageRaw(U32 bitmap_num) const
 
 LLImageGL *LLFontBitmapCache::getImageGL(U32 bitmap_num) const
 {
-	if ((bitmap_num < 0) || (bitmap_num >= mImageGLVec.size()))
+	if (bitmap_num >= mImageGLVec.size())
 		return NULL;
 
 	return mImageGLVec[bitmap_num];
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp
index 46478ba3c9577b0131b277e733aa33ffb817e5d8..8bcc4723ae2ab61d1006f02261262e7ad8370ff3 100644
--- a/indra/llrender/llimagegl.cpp
+++ b/indra/llrender/llimagegl.cpp
@@ -1716,10 +1716,7 @@ void LLImageGL::updatePickMask(S32 width, S32 height, const U8* data_in)
 			{
 				U32 pick_idx = pick_bit/8;
 				U32 pick_offset = pick_bit%8;
-				if (pick_idx >= size)
-				{
-					llerrs << "WTF?" << llendl;
-				}
+				llassert(pick_idx < size);
 
 				mPickMask[pick_idx] |= 1 << pick_offset;
 			}
diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp
index 572ae1390994c50706a493acb648a2ef5998e093..ecfe845b3427dfafbdd8eccbb82d3c074c7c6a5b 100644
--- a/indra/llrender/llvertexbuffer.cpp
+++ b/indra/llrender/llvertexbuffer.cpp
@@ -237,7 +237,7 @@ void LLVertexBuffer::drawRange(U32 mode, U32 start, U32 end, U32 count, U32 indi
 		llerrs << "Wrong vertex buffer bound." << llendl;
 	}
 
-	if (mode > LLRender::NUM_MODES)
+	if (mode >= LLRender::NUM_MODES)
 	{
 		llerrs << "Invalid draw mode: " << mode << llendl;
 		return;
@@ -267,7 +267,7 @@ void LLVertexBuffer::draw(U32 mode, U32 count, U32 indices_offset) const
 		llerrs << "Wrong vertex buffer bound." << llendl;
 	}
 
-	if (mode > LLRender::NUM_MODES)
+	if (mode >= LLRender::NUM_MODES)
 	{
 		llerrs << "Invalid draw mode: " << mode << llendl;
 		return;
@@ -292,7 +292,7 @@ void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const
 		llerrs << "Wrong vertex buffer bound." << llendl;
 	}
 
-	if (mode > LLRender::NUM_MODES)
+	if (mode >= LLRender::NUM_MODES)
 	{
 		llerrs << "Invalid draw mode: " << mode << llendl;
 		return;
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index c172a2b714f88ceb8a1bd6513cd4ab564a720a0a..ceb1e9820eb279338b0d15674924f5c4efd4a32d 100644
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -1875,17 +1875,21 @@ void LLMenuGL::scrollItemsDown()
 
 	item_list_t::iterator next_item_iter;
 
-	for (next_item_iter = ++cur_item_iter; next_item_iter != mItems.end(); next_item_iter++)
+	if (cur_item_iter != mItems.end())
 	{
-		if( (*next_item_iter)->getVisible())
+		for (next_item_iter = ++cur_item_iter; next_item_iter != mItems.end(); next_item_iter++)
 		{
-			break;
+			if( (*next_item_iter)->getVisible())
+			{
+				break;
+			}
+		}
+		
+		if (next_item_iter != mItems.end() &&
+		    (*next_item_iter)->getVisible())
+		{
+			mFirstVisibleItem = *next_item_iter;
 		}
-	}
-
-	if ((*next_item_iter)->getVisible())
-	{
-		mFirstVisibleItem = *next_item_iter;
 	}
 	
 	mNeedsArrange = TRUE;
diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp
index 86989012ee4c34842f2ef8c500606d444ae58c0d..a67094b8cea9a13f5419b5ba5d064f50b4321a50 100644
--- a/indra/llui/llnotifications.cpp
+++ b/indra/llui/llnotifications.cpp
@@ -1058,6 +1058,7 @@ LLNotificationChannelPtr LLNotifications::getChannel(const std::string& channelN
 	if(p == mChannels.end())
 	{
 		llerrs << "Did not find channel named " << channelName << llendl;
+		return LLNotificationChannelPtr();
 	}
 	return p->second;
 }
diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp
index dcb3542e1864f7dbd38ec5e082425fdf2bfd5fe9..6be76605fdf3881ac82dab7f49cfec02e267cc07 100644
--- a/indra/llui/lltabcontainer.cpp
+++ b/indra/llui/lltabcontainer.cpp
@@ -1590,7 +1590,10 @@ void LLTabContainer::onTabBtn( const LLSD& data, LLPanel* panel )
 	LLTabTuple* tuple = getTabByPanel(panel);
 	selectTabPanel( panel );
 
-	tuple->mTabPanel->setFocus(TRUE);
+	if (tuple)
+	{
+		tuple->mTabPanel->setFocus(TRUE);
+	}
 }
 
 void LLTabContainer::onNextBtn( const LLSD& data )
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 7ddeb90d295c863e539e89ca8cd5a02cb9179696..4c0c895a7df00f2aa178d92c7ef4c1977ac536d4 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -1064,11 +1064,13 @@ if (DARWIN)
   find_library(APPKIT_LIBRARY AppKit)
   find_library(COCOA_LIBRARY Cocoa)
   find_library(IOKIT_LIBRARY IOKit)
+  find_library(COREAUDIO_LIBRARY CoreAudio)
 
   set(viewer_LIBRARIES
     ${COCOA_LIBRARY}
     ${AGL_LIBRARY}
     ${IOKIT_LIBRARY}
+    ${COREAUDIO_LIBRARY}
     )
 
   # Add resource files to the project.
diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index c21cdf95085ea62c67f1f0cfda8345c1f34fddbd..b0ff3a56261ff11b46f35277a540f15ca1cf410b 100644
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -1130,8 +1130,9 @@ void LLAgentWearables::addLocalTextureObject(const EWearableType wearable_type,
 	if (!wearable)
 	{
 		llerrs << "Tried to add local texture object to invalid wearable with type " << wearable_type << " and index " << wearable_index << llendl;
+		return;
 	}
-	LLLocalTextureObject* lto = new LLLocalTextureObject();
+	LLLocalTextureObject lto;
 	wearable->setLocalTextureObject(texture_type, lto);
 }
 
@@ -2527,6 +2528,7 @@ void LLInitialWearablesFetch::processWearablesMessage()
 			{
 				llinfos << "Invalid wearable, type " << wearable_data->mType << " itemID "
 				<< wearable_data->mItemID << " assetID " << wearable_data->mAssetID << llendl;
+				delete wearable_data;
 			}
 		}
 
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index 1dec8c7bd8576034ef15c7c815945e0226ab3878..8f4ce4498efa9dc462fb7d582677b0a5cae9bdac 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -292,11 +292,11 @@ class LLUpdateAppearanceOnDestroy: public LLInventoryCallback
 
 struct LLFoundData
 {
-	LLFoundData() {}
+	LLFoundData() : mAssetType(LLAssetType::AT_NONE), mWearable(NULL) {}
 	LLFoundData(const LLUUID& item_id,
-				const LLUUID& asset_id,
-				const std::string& name,
-				LLAssetType::EType asset_type) :
+		    const LLUUID& asset_id,
+		    const std::string& name,
+		    LLAssetType::EType asset_type) :
 		mItemID(item_id),
 		mAssetID(asset_id),
 		mName(name),
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 0e248ff88bfd5dab8ce4c95fd52808af15d0a0d0..9aa15789edc59dce350a4cf6fd4af6e19f5b34d3 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -2685,7 +2685,7 @@ void LLAppViewer::handleViewerCrash()
 		gMessageSystem->stopLogging();
 	}
 
-	LLWorld::getInstance()->getInfo(gDebugInfo);
+	if (LLWorld::instanceExists()) LLWorld::getInstance()->getInfo(gDebugInfo);
 
 	// Close the debug file
 	pApp->writeDebugInfo();
@@ -4405,3 +4405,15 @@ void LLAppViewer::launchUpdater()
 	// LLAppViewer::instance()->forceQuit();
 }
 
+
+//virtual
+void LLAppViewer::setMasterSystemAudioMute(bool mute)
+{
+	gSavedSettings.setBOOL("MuteAudio", mute);
+}
+
+//virtual
+bool LLAppViewer::getMasterSystemAudioMute()
+{
+	return gSavedSettings.getBOOL("MuteAudio");
+}
diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h
index 40e74061b541386c4d35f20b693fc542d4f865a5..a011c5ebfd6f60683b50b37f20161a8ae6b60f84 100644
--- a/indra/newview/llappviewer.h
+++ b/indra/newview/llappviewer.h
@@ -168,6 +168,10 @@ class LLAppViewer : public LLApp
 
 	void purgeCache(); // Clear the local cache. 
 	
+	// mute/unmute the system's master audio
+	virtual void setMasterSystemAudioMute(bool mute);
+	virtual bool getMasterSystemAudioMute();
+	
 protected:
 	virtual bool initWindow(); // Initialize the viewer's window.
 	virtual bool initLogging(); // Initialize log files, logging system, return false on failure.
diff --git a/indra/newview/llappviewermacosx.cpp b/indra/newview/llappviewermacosx.cpp
index 1282e437f2faedb385cd3848964f8bfe854b88ae..f8f8f50cd6c375a38d151869633616474fc16992 100644
--- a/indra/newview/llappviewermacosx.cpp
+++ b/indra/newview/llappviewermacosx.cpp
@@ -50,6 +50,7 @@
 #include <Carbon/Carbon.h>
 #include "lldir.h"
 #include <signal.h>
+#include <CoreAudio/CoreAudio.h>	// for systemwide mute
 class LLMediaCtrl;		// for LLURLDispatcher
 
 namespace 
@@ -444,6 +445,59 @@ std::string LLAppViewerMacOSX::generateSerialNumber()
 	return serial_md5;
 }
 
+static AudioDeviceID get_default_audio_output_device(void)
+{
+	AudioDeviceID device = 0;
+	UInt32 size;
+	OSStatus err;
+	
+	size = sizeof(device);
+	err = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice, &size, &device);
+	if(err != noErr)
+	{
+		LL_DEBUGS("SystemMute") << "Couldn't get default audio output device (0x" << std::hex << err << ")" << LL_ENDL;
+	}
+	
+	return device;
+}
+
+//virtual
+void LLAppViewerMacOSX::setMasterSystemAudioMute(bool new_mute)
+{
+	AudioDeviceID device = get_default_audio_output_device();
+	
+	if(device != 0)
+	{
+		UInt32 mute = new_mute;
+		OSStatus err = AudioDeviceSetProperty(device, NULL, 0, false, kAudioDevicePropertyMute, sizeof(mute), &mute);
+		if(err != noErr)
+		{
+			LL_INFOS("SystemMute") << "Couldn't set audio mute property (0x" << std::hex << err << ")" << LL_ENDL;
+		}
+	}
+}
+
+//virtual
+bool LLAppViewerMacOSX::getMasterSystemAudioMute()
+{
+	// Assume the system isn't muted 
+	UInt32 mute = 0;
+	
+	AudioDeviceID device = get_default_audio_output_device();
+	
+	if(device != 0)
+	{
+		UInt32 size = sizeof(mute);
+		OSStatus err = AudioDeviceGetProperty(device, 0, false, kAudioDevicePropertyMute, &size, &mute);
+		if(err != noErr)
+		{
+			LL_DEBUGS("SystemMute") << "Couldn't get audio mute property (0x" << std::hex << err << ")" << LL_ENDL;
+		}
+	}
+	
+	return (mute != 0);
+}
+
 OSErr AEGURLHandler(const AppleEvent *messagein, AppleEvent *reply, long refIn)
 {
 	OSErr result = noErr;
diff --git a/indra/newview/llappviewermacosx.h b/indra/newview/llappviewermacosx.h
index bc841fc3a72966c28f11616118bc17aa29b8088f..cbf7e6c2095485b7fdc61bbe1240a5c3f2fad09a 100644
--- a/indra/newview/llappviewermacosx.h
+++ b/indra/newview/llappviewermacosx.h
@@ -48,6 +48,9 @@ class LLAppViewerMacOSX : public LLAppViewer
 	//
 	virtual bool init();			// Override to do application initialization
 
+	// mute/unmute the system's master audio
+	virtual void setMasterSystemAudioMute(bool mute);
+	virtual bool getMasterSystemAudioMute();
 
 protected:
 	virtual bool restoreErrorTrap();
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp
index eef774426a0a0ae530ea23891e1e5a91d0ca43cb..965ac1cad0b11cf40ca5833be8446d0ac57e6f8a 100644
--- a/indra/newview/llface.cpp
+++ b/indra/newview/llface.cpp
@@ -157,6 +157,7 @@ void LLFace::init(LLDrawable* drawablep, LLViewerObject* objp)
 	mGeomIndex		= 0;
 	mIndicesCount	= 0;
 	mIndicesIndex	= 0;
+	mIndexInTex = 0;
 	mTexture		= NULL;
 	mTEOffset		= -1;
 
diff --git a/indra/newview/llflexibleobject.cpp b/indra/newview/llflexibleobject.cpp
index fc8790c1722f664ce1a7235693a6cf735e6d1adb..aea2de8e92f110366dbc94bccb59b83d2a68630d 100644
--- a/indra/newview/llflexibleobject.cpp
+++ b/indra/newview/llflexibleobject.cpp
@@ -66,6 +66,7 @@ LLVolumeImplFlexible::LLVolumeImplFlexible(LLViewerObject* vo, LLFlexibleObjectD
 	mInitializedRes = -1;
 	mSimulateRes = 0;
 	mFrameNum = 0;
+	mCollisionSphereRadius = 0.f;
 	mRenderRes = 1;
 
 	if(mVO->mDrawable.notNull())
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp
index 85353ce308f9e8ff3fdae7c30974e00bfd720a4d..d54736e942b35d0b4e97145718e5bdae020613dc 100644
--- a/indra/newview/llfloaterregioninfo.cpp
+++ b/indra/newview/llfloaterregioninfo.cpp
@@ -1521,11 +1521,6 @@ void LLPanelEstateInfo::onClickRemoveEstateManager(void* user_data)
 //---------------------------------------------------------------------------
 // Kick from estate methods
 //---------------------------------------------------------------------------
-struct LLKickFromEstateInfo
-{
-	LLPanelEstateInfo *mEstatePanelp;
-	LLUUID      mAgentID;
-};
 
 void LLPanelEstateInfo::onClickKickUser()
 {
@@ -1547,11 +1542,6 @@ void LLPanelEstateInfo::onKickUserCommit(const std::vector<std::string>& names,
 		return;
 	}
 
-	//keep track of what user they want to kick and other misc info
-	LLKickFromEstateInfo *kick_info = new LLKickFromEstateInfo();
-	kick_info->mEstatePanelp = this;
-	kick_info->mAgentID     = ids[0];
-
 	//Bring up a confirmation dialog
 	LLSD args;
 	args["EVIL_USER"] = names[0];
diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h
index 759d0cba18a5b1e8b57255f1bd3ff44de5ec5a00..eeb8246b112245d57bbe0d016b118c2eeaaf991a 100644
--- a/indra/newview/llinventorybridge.h
+++ b/indra/newview/llinventorybridge.h
@@ -320,8 +320,12 @@ class LLFolderBridge : public LLInvFVBridge
 	LLViewerInventoryCategory* getCategory() const;
 
 protected:
-	LLFolderBridge(LLInventoryPanel* inventory, const LLUUID& uuid) :
-		LLInvFVBridge(inventory, uuid), mCallingCards(FALSE), mWearables(FALSE) {}
+	LLFolderBridge(LLInventoryPanel* inventory, const LLUUID& uuid)
+		: LLInvFVBridge(inventory, uuid),
+
+		mCallingCards(FALSE),
+		mWearables(FALSE),
+		mMenu(NULL) {}
 
 	// menu callbacks
 	static void pasteClipboard(void* user_data);
diff --git a/indra/newview/lllocaltextureobject.cpp b/indra/newview/lllocaltextureobject.cpp
index 6bcbe6f58ca1304797dcb7e2c3cbe010e2926633..69eb5fce2fc559a08faf8a8e07aedd13eedd56af 100644
--- a/indra/newview/lllocaltextureobject.cpp
+++ b/indra/newview/lllocaltextureobject.cpp
@@ -47,7 +47,9 @@ LLLocalTextureObject::LLLocalTextureObject() :
 	mImage = NULL;
 }
 
-LLLocalTextureObject::LLLocalTextureObject(LLViewerFetchedTexture* image, const LLUUID& id)
+LLLocalTextureObject::LLLocalTextureObject(LLViewerFetchedTexture* image, const LLUUID& id) :
+	mIsBakedReady(FALSE),
+	mDiscard(MAX_DISCARD_LEVEL+1)
 {
 	mImage = image;
 	gGL.getTexUnit(0)->bind(mImage);
diff --git a/indra/newview/lllocationhistory.cpp b/indra/newview/lllocationhistory.cpp
index ae1b8f854080c7a3a3605b46372d451409a24f8d..f494f7d7c1db0fd304f82d4eb5c5dc26e9027674 100644
--- a/indra/newview/lllocationhistory.cpp
+++ b/indra/newview/lllocationhistory.cpp
@@ -50,18 +50,19 @@ void LLLocationHistory::addItem(const LLLocationHistoryItem& item) {
 
 	// check if this item doesn't duplicate any existing one
 	location_list_t::iterator item_iter = std::find(mItems.begin(), mItems.end(),item);
-	if(item_iter != mItems.end()){
+	if(item_iter != mItems.end()) // if it already exists, erase the old one
+	{
 		mItems.erase(item_iter);	
 	}
 
 	mItems.push_back(item);
 	
-	// If the vector size exceeds the maximum, purge the oldest items.
-	if ((S32)mItems.size() > max_items) {
-		for(location_list_t::iterator i = mItems.begin(); i != mItems.end()-max_items; ++i) {
-				mItems.erase(i);
-		}
+	// If the vector size exceeds the maximum, purge the oldest items (at the start of the mItems vector).
+	if ((S32)mItems.size() > max_items)
+	{
+		mItems.erase(mItems.begin(), mItems.end()-max_items);
 	}
+	llassert(mItems.size() <= max_items);
 }
 
 /*
diff --git a/indra/newview/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp
index 23db7ad226b505ee2c3d05390fdee94fbce1f984..469f1c1739a9dafc96a6378bf23bf56ed5e734fa 100644
--- a/indra/newview/llpanelgroup.cpp
+++ b/indra/newview/llpanelgroup.cpp
@@ -569,10 +569,10 @@ void LLPanelGroup::chatGroup()
 }
 
 void LLPanelGroup::showNotice(const std::string& subject,
-							  const std::string& message,
-							  const bool& has_inventory,
-							  const std::string& inventory_name,
-							  LLOfferInfo* inventory_offer)
+			      const std::string& message,
+			      const bool& has_inventory,
+			      const std::string& inventory_name,
+			      LLOfferInfo* inventory_offer)
 {
 	LLPanelGroupNotices* panel_notices = findChild<LLPanelGroupNotices>("group_notices_tab_panel");
 	if(!panel_notices)
diff --git a/indra/newview/llpanellandmarkinfo.cpp b/indra/newview/llpanellandmarkinfo.cpp
index c792fd4fe3a708c20c0e575f656f5e54b1523d05..7a17d4a1f020d4daa6658be00de436b4aadca1f2 100644
--- a/indra/newview/llpanellandmarkinfo.cpp
+++ b/indra/newview/llpanellandmarkinfo.cpp
@@ -108,7 +108,7 @@ void LLPanelLandmarkInfo::resetLocation()
 }
 
 // virtual
-void LLPanelLandmarkInfo::setInfoType(INFO_TYPE type)
+void LLPanelLandmarkInfo::setInfoType(EInfoType type)
 {
 	LLPanel* landmark_info_panel = getChild<LLPanel>("landmark_info_panel");
 
diff --git a/indra/newview/llpanellandmarkinfo.h b/indra/newview/llpanellandmarkinfo.h
index 2a9949ae41c0288f0057f9f4beefddf00458991d..b3dc3f5ad9d97ff893b0658f8781e6228b7787db 100644
--- a/indra/newview/llpanellandmarkinfo.h
+++ b/indra/newview/llpanellandmarkinfo.h
@@ -49,7 +49,7 @@ class LLPanelLandmarkInfo : public LLPanelPlaceInfo
 
 	/*virtual*/ void resetLocation();
 
-	/*virtual*/ void setInfoType(INFO_TYPE type);
+	/*virtual*/ void setInfoType(EInfoType type);
 
 	/*virtual*/ void processParcelInfo(const LLParcelData& parcel_data);
 
diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp
index d4376550d6c00fd98622d9fe949e706489bfac1d..5c5c35141eaab4d7bf89905ef7bc43bd297f8ed4 100644
--- a/indra/newview/llpanelobjectinventory.cpp
+++ b/indra/newview/llpanelobjectinventory.cpp
@@ -463,10 +463,6 @@ BOOL LLTaskInvFVBridge::removeItem()
 			}
 			else
 			{
-				remove_data_t* data = new remove_data_t;
-				data->first = mPanel;
-				data->second.first = mPanel->getTaskUUID();
-				data->second.second.push_back(mUUID);
 				LLSD payload;
 				payload["task_id"] = mPanel->getTaskUUID();
 				payload["inventory_ids"].append(mUUID);
diff --git a/indra/newview/llpanelplaceinfo.cpp b/indra/newview/llpanelplaceinfo.cpp
index 5f75668722eca299be8d04c74534a2cba0c54c79..9ebc8ca2b93e3044e3b0d13fb9bf7f37b26e4155 100644
--- a/indra/newview/llpanelplaceinfo.cpp
+++ b/indra/newview/llpanelplaceinfo.cpp
@@ -58,6 +58,7 @@ LLPanelPlaceInfo::LLPanelPlaceInfo()
 	mPosRegion(),
 	mScrollingPanelMinHeight(0),
 	mScrollingPanelWidth(0),
+	mInfoType(UNKNOWN),
 	mScrollingPanel(NULL),
 	mScrollContainer(NULL)
 {}
@@ -120,7 +121,7 @@ void LLPanelPlaceInfo::setParcelID(const LLUUID& parcel_id)
 }
 
 //virtual
-void LLPanelPlaceInfo::setInfoType(INFO_TYPE type)
+void LLPanelPlaceInfo::setInfoType(EInfoType type)
 {
 	mTitle->setText(mCurrentTitle);
 
diff --git a/indra/newview/llpanelplaceinfo.h b/indra/newview/llpanelplaceinfo.h
index 3091f7ed24a63abdc7ad7922133c340dc4e9b8d1..deedbd2b0f6f37db4bee5cd27fdb89628c9fbd8a 100644
--- a/indra/newview/llpanelplaceinfo.h
+++ b/indra/newview/llpanelplaceinfo.h
@@ -54,8 +54,10 @@ class LLViewerInventoryCategory;
 class LLPanelPlaceInfo : public LLPanel, LLRemoteParcelInfoObserver
 {
 public:
-	enum INFO_TYPE
+	enum EInfoType
 	{
+		UNKNOWN,
+
 		AGENT,
 		CREATE_LANDMARK,
 		LANDMARK,
@@ -79,7 +81,7 @@ class LLPanelPlaceInfo : public LLPanel, LLRemoteParcelInfoObserver
 	// Depending on how the panel was triggered
 	// (from landmark or current location, or other)
 	// sets a corresponding title and contents.
-	virtual void setInfoType(INFO_TYPE type);
+	virtual void setInfoType(EInfoType type);
 
 	// Requests remote parcel info by parcel ID.
 	void sendParcelInfoRequest();
@@ -114,7 +116,7 @@ class LLPanelPlaceInfo : public LLPanel, LLRemoteParcelInfoObserver
 	std::string				mCurrentTitle;
 	S32						mScrollingPanelMinHeight;
 	S32						mScrollingPanelWidth;
-	INFO_TYPE 				mInfoType;
+	EInfoType 				mInfoType;
 
 	LLScrollContainer*		mScrollContainer;
 	LLPanel*				mScrollingPanel;
diff --git a/indra/newview/llpanelplaceprofile.cpp b/indra/newview/llpanelplaceprofile.cpp
index 3c798639d4ecac574bef5f9868b3db1c206fc44f..8d689b2c5e4c37d6c8ae2f9df2f91b6fc47d4263 100644
--- a/indra/newview/llpanelplaceprofile.cpp
+++ b/indra/newview/llpanelplaceprofile.cpp
@@ -207,7 +207,7 @@ void LLPanelPlaceProfile::resetLocation()
 }
 
 // virtual
-void LLPanelPlaceProfile::setInfoType(INFO_TYPE type)
+void LLPanelPlaceProfile::setInfoType(EInfoType type)
 {
 	bool is_info_type_agent = type == AGENT;
 
diff --git a/indra/newview/llpanelplaceprofile.h b/indra/newview/llpanelplaceprofile.h
index 8ca95268750114ff376231823ef654152ea50245..e77b4415671dbf59a02b6056b1d10447785e6370 100644
--- a/indra/newview/llpanelplaceprofile.h
+++ b/indra/newview/llpanelplaceprofile.h
@@ -48,7 +48,7 @@ class LLPanelPlaceProfile : public LLPanelPlaceInfo
 
 	/*virtual*/ void resetLocation();
 
-	/*virtual*/ void setInfoType(INFO_TYPE type);
+	/*virtual*/ void setInfoType(EInfoType type);
 
 	/*virtual*/ void processParcelInfo(const LLParcelData& parcel_data);
 
diff --git a/indra/newview/llpanelteleporthistory.cpp b/indra/newview/llpanelteleporthistory.cpp
index 1b8fb496418f35b935431fd18c19f7e21259ae45..6005881148dc8cd5ce05815994b6202516f8c60d 100644
--- a/indra/newview/llpanelteleporthistory.cpp
+++ b/indra/newview/llpanelteleporthistory.cpp
@@ -308,7 +308,7 @@ void LLTeleportHistoryFlatItemStorage::purge()
 ////////////////////////////////////////////////////////////////////////////////
 
 LLTeleportHistoryPanel::ContextMenu::ContextMenu() :
-	mMenu(NULL)
+	mMenu(NULL), mIndex(0)
 {
 }
 
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index 60a095506b1d431e4bef79c0d3ed72205066ca92..6f76715e732d3871cfc3bb3ccf65ac3a03288c46 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -5093,6 +5093,7 @@ LLSelectNode::LLSelectNode(const LLSelectNode& nodep)
 	mName = nodep.mName;
 	mDescription = nodep.mDescription;
 	mCategory = nodep.mCategory;
+	mInventorySerial = 0;
 	mSavedPositionLocal = nodep.mSavedPositionLocal;
 	mSavedPositionGlobal = nodep.mSavedPositionGlobal;
 	mSavedScale = nodep.mSavedScale;
diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp
index 514d8facb447dfa70dffcbcd3810de70aaa6e488..2a57d48f16bd45e722d0b0b9fc6d7fa6b55cf46a 100644
--- a/indra/newview/llspatialpartition.cpp
+++ b/indra/newview/llspatialpartition.cpp
@@ -294,7 +294,7 @@ LLSpatialGroup::~LLSpatialGroup()
 	
 	sNodeCount--;
 
-	if (gGLManager.mHasOcclusionQuery && mOcclusionQuery)
+	if (gGLManager.mHasOcclusionQuery && mOcclusionQuery[LLViewerCamera::sCurCameraID])
 	{
 		sQueryPool.release(mOcclusionQuery[LLViewerCamera::sCurCameraID]);
 	}
@@ -2607,6 +2607,7 @@ void renderBoundingBox(LLDrawable* drawable, BOOL set_color = TRUE)
 						break;
 				case LL_PCODE_LEGACY_TREE:
 						gGL.color4f(0,0.5f,0,1);
+						break;
 				default:
 						gGL.color4f(1,0,1,1);
 						break;
diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp
index 8a36475510f432a18b9f5a8badb7b4f8e7742aae..bff32af228ccb56f0da079cfb4d464aad9a412c4 100644
--- a/indra/newview/llstatusbar.cpp
+++ b/indra/newview/llstatusbar.cpp
@@ -354,7 +354,7 @@ void LLStatusBar::refresh()
 	childSetEnabled("stat_btn", net_stats_visible);
 
 	// update the master volume button state
-	BOOL mute_audio = gSavedSettings.getBOOL("MuteAudio");
+	bool mute_audio = LLAppViewer::instance()->getMasterSystemAudioMute();
 	mBtnVolume->setToggleState(mute_audio);
 }
 
@@ -523,8 +523,8 @@ void LLStatusBar::onMouseEnterVolume(LLUICtrl* ctrl)
 static void onClickVolume(void* data)
 {
 	// toggle the master mute setting
-	BOOL mute_audio = gSavedSettings.getBOOL("MuteAudio");
-	gSavedSettings.setBOOL("MuteAudio", !mute_audio);
+	bool mute_audio = LLAppViewer::instance()->getMasterSystemAudioMute();
+	LLAppViewer::instance()->setMasterSystemAudioMute(!mute_audio);	
 }
 
 // sets the static variables necessary for the date
diff --git a/indra/newview/llsurfacepatch.cpp b/indra/newview/llsurfacepatch.cpp
index 0ce794addb621e0401f580d2f68569f850ed74b7..48e4a6ccc7517902f4a357fc9ff87ff962c8f853 100644
--- a/indra/newview/llsurfacepatch.cpp
+++ b/indra/newview/llsurfacepatch.cpp
@@ -60,6 +60,7 @@ LLSurfacePatch::LLSurfacePatch() :
 	mHeightsGenerated(FALSE),
 	mDataOffset(0),
 	mDataZ(NULL),
+	mDataNorm(NULL),
 	mVObjp(NULL),
 	mOriginRegion(0.f, 0.f, 0.f),
 	mCenterRegion(0.f, 0.f, 0.f),
@@ -355,12 +356,14 @@ void LLSurfacePatch::calcNormal(const U32 x, const U32 y, const U32 stride)
 	normal %= c2;
 	normal.normVec();
 
+	llassert(mDataNorm);
 	*(mDataNorm + surface_stride * y + x) = normal;
 }
 
 const LLVector3 &LLSurfacePatch::getNormal(const U32 x, const U32 y) const
 {
 	U32 surface_stride = mSurfacep->getGridsPerEdge();
+	llassert(mDataNorm);
 	return *(mDataNorm + surface_stride * y + x);
 }
 
@@ -402,6 +405,7 @@ void LLSurfacePatch::updateVerticalStats()
 	U32 i, j, k;
 	F32 z, total;
 
+	llassert(mDataZ);
 	z = *(mDataZ);
 
 	mMinZ = z;
diff --git a/indra/newview/lltexlayer.cpp b/indra/newview/lltexlayer.cpp
index 84c8b9d5f06f55cf2542a1c909241df0f7d744e3..ddb6405c41252f7998cae37ad3f5af1ebf1fb95a 100644
--- a/indra/newview/lltexlayer.cpp
+++ b/indra/newview/lltexlayer.cpp
@@ -567,6 +567,7 @@ LLTexLayerSet::LLTexLayerSet(LLVOAvatarSelf* const avatar) :
 	mAvatar( avatar ),
 	mUpdatesEnabled( FALSE ),
 	mIsVisible( TRUE ),
+	mBakedTexIndex(LLVOAvatarDefines::BAKED_HEAD),
 	mInfo( NULL )
 {
 }
@@ -1860,7 +1861,7 @@ U32 LLTexLayerTemplate::updateWearableCache()
 }
 LLTexLayer* LLTexLayerTemplate::getLayer(U32 i)
 {
-	if (mWearableCache.size() <= i || i < 0)
+	if (mWearableCache.size() <= i)
 	{
 		return NULL;
 	}
diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp
index 051c189013e6e5e906741f161b2c078a51547258..a7f26f1df15b4f56cdb6bce292a63f4da5212a72 100644
--- a/indra/newview/lltexturecache.cpp
+++ b/indra/newview/lltexturecache.cpp
@@ -1617,20 +1617,20 @@ bool LLTextureCache::writeComplete(handle_t handle, bool abort)
 {
 	lockWorkers();
 	handle_map_t::iterator iter = mWriters.find(handle);
-	llassert_always(iter != mWriters.end());
-	LLTextureCacheWorker* worker = iter->second;
-	if (worker->complete() || abort)
-	{
-		mWriters.erase(handle);
-		unlockWorkers();
-		worker->scheduleDelete();
-		return true;
-	}
-	else
+	llassert(iter != mWriters.end());
+	if (iter != mWriters.end())
 	{
-		unlockWorkers();
-		return false;
+		LLTextureCacheWorker* worker = iter->second;
+		if (worker->complete() || abort)
+		{
+			mWriters.erase(handle);
+			unlockWorkers();
+			worker->scheduleDelete();
+			return true;
+		}
 	}
+	unlockWorkers();
+	return false;
 }
 
 void LLTextureCache::prioritizeWrite(handle_t handle)
diff --git a/indra/newview/lltexturecache.h b/indra/newview/lltexturecache.h
index 4203cbbc433c178bc58d3a8b7920ac803b19a7f4..64ec881fc31557db809adae5e66f2760cbadc859 100644
--- a/indra/newview/lltexturecache.h
+++ b/indra/newview/lltexturecache.h
@@ -59,7 +59,12 @@ class LLTextureCache : public LLWorkerThread
 	};
 	struct Entry
 	{
-		Entry() {}
+        	Entry() :
+		        mBodySize(0),
+			mImageSize(0),
+			mTime(0)
+		{
+		}
 		Entry(const LLUUID& id, S32 imagesize, S32 bodysize, U32 time) :
 			mID(id), mImageSize(imagesize), mBodySize(bodysize), mTime(time) {}
 		void init(const LLUUID& id, U32 time) { mID = id, mImageSize = 0; mBodySize = 0; mTime = time; }
diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp
index 5ce6884239021ae386106baa92fbf55a6f5f9431..404b79bfaf9193400e2cce312abf4bf81b08c251 100644
--- a/indra/newview/lltexturefetch.cpp
+++ b/indra/newview/lltexturefetch.cpp
@@ -661,6 +661,8 @@ bool LLTextureFetchWorker::doWork(S32 param)
 				}
 				setPriority(LLWorkerThread::PRIORITY_HIGH | mWorkPriority);
 				mState = SEND_HTTP_REQ;
+				delete responder;
+				responder = NULL;
 			}
 		}
 
diff --git a/indra/newview/lltoolbar.cpp b/indra/newview/lltoolbar.cpp
index edbaa0d45a4ca04dc717d1300b950c342b451d02..e7dc7ae522c928bece62d6be8ac1ef9a6c87ca2b 100644
--- a/indra/newview/lltoolbar.cpp
+++ b/indra/newview/lltoolbar.cpp
@@ -95,7 +95,10 @@ F32	LLToolBar::sInventoryAutoOpenTime = 1.f;
 //
 
 LLToolBar::LLToolBar()
-:	LLPanel()
+	: LLPanel(),
+
+	mInventoryAutoOpen(FALSE),
+	mNumUnreadIMs(0)	
 #if LL_DARWIN
 	, mResizeHandle(NULL)
 #endif // LL_DARWIN
diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp
index 4420b046d8ffe64a451b2c4c0ae1a33bd7d35f8e..125c62474ec11fb7fd29ffe3d6bb7fbab0456e80 100644
--- a/indra/newview/lltooldraganddrop.cpp
+++ b/indra/newview/lltooldraganddrop.cpp
@@ -1404,18 +1404,6 @@ void LLToolDragAndDrop::dropInventory(LLViewerObject* hit_obj,
 	gFloaterTools->dirty();
 }
 
-struct LLGiveInventoryInfo
-{
-	LLUUID mToAgentID;
-	LLUUID mInventoryObjectID;
-	LLUUID mIMSessionID;
-	LLGiveInventoryInfo(const LLUUID& to_agent, const LLUUID& obj_id, const LLUUID &im_session_id = LLUUID::null) :
-		mToAgentID(to_agent), 
-		mInventoryObjectID(obj_id),
-		mIMSessionID(im_session_id)
-	{}
-};
-
 void LLToolDragAndDrop::giveInventory(const LLUUID& to_agent,
 									  LLInventoryItem* item,
 									  const LLUUID& im_session_id)
@@ -1584,8 +1572,6 @@ void LLToolDragAndDrop::giveInventoryCategory(const LLUUID& to_agent,
 		}
 		else 
 		{
-			LLGiveInventoryInfo* info = NULL;
-			info = new LLGiveInventoryInfo(to_agent, cat->getUUID(), im_session_id);
 			LLSD args;
 			args["COUNT"] = llformat("%d",giveable.countNoCopy());
 			LLSD payload;
diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp
index c79a66892d56be16a425262b83e2dc32165e829f..39e71974fdc8594f84800517ed7d2616e428b81e 100644
--- a/indra/newview/lltoolpie.cpp
+++ b/indra/newview/lltoolpie.cpp
@@ -922,7 +922,7 @@ BOOL LLToolPie::handleTooltipObject( LLViewerObject* hover_object, std::string l
 				const LLMediaEntry* mep = tep->hasMedia() ? tep->getMediaData() : NULL;
 				if (mep)
 				{
-					viewer_media_t media_impl = mep ? LLViewerMedia::getMediaImplFromTextureID(mep->getMediaID()) : NULL;
+					viewer_media_t media_impl = LLViewerMedia::getMediaImplFromTextureID(mep->getMediaID());
 					LLPluginClassMedia* media_plugin = NULL;
 					
 					if (media_impl.notNull() && (media_impl->hasMedia()))
diff --git a/indra/newview/llviewerjoint.cpp b/indra/newview/llviewerjoint.cpp
index c2591ac8d7d1ff025d268bd8cda8e2fc76affc79..c425d95ff807f728745196885c91bfb30491b523 100644
--- a/indra/newview/llviewerjoint.cpp
+++ b/indra/newview/llviewerjoint.cpp
@@ -66,6 +66,7 @@ LLViewerJoint::LLViewerJoint()
 	mMinPixelArea = DEFAULT_LOD;
 	mPickName = PN_DEFAULT;
 	mVisible = TRUE;
+	mMeshID = 0;
 }
 
 
diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp
index 5b8902dec48be1f1803caba1cd6c37f200df472c..1a67fc09664de606e6ce747f514df615b49274d1 100644
--- a/indra/newview/llviewerjointmesh.cpp
+++ b/indra/newview/llviewerjointmesh.cpp
@@ -147,6 +147,7 @@ LLViewerJointMesh::LLViewerJointMesh()
 	mTexture( NULL ),
 	mLayerSet( NULL ),
 	mTestImageName( 0 ),
+	mFaceIndexCount(0),
 	mIsTransparent(FALSE)
 {
 
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 36710e7532e504c737f94b708a3c04480657f498..aa77c9602fec97fae6c989f54d240f6564596af2 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -1933,7 +1933,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 
 			if (has_inventory)
 			{
-				info = new LLOfferInfo;
+				info = new LLOfferInfo();
 				
 				info->mIM = IM_GROUP_NOTICE;
 				info->mFromID = from_id;
@@ -1987,6 +1987,10 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 				
 				LLPanelGroup::showNotice(subj,mes,group_id,has_inventory,item_name,info);
 			}
+			else
+			{
+				delete info;
+			}
 		}
 		break;
 	case IM_GROUP_INVITATION:
@@ -2047,6 +2051,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 				if (sizeof(offer_agent_bucket_t) != binary_bucket_size)
 				{
 					LL_WARNS("Messaging") << "Malformed inventory offer from agent" << LL_ENDL;
+					delete info;
 					break;
 				}
 				bucketp = (struct offer_agent_bucket_t*) &binary_bucket[0];
@@ -2058,6 +2063,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 				if (sizeof(S8) != binary_bucket_size)
 				{
 					LL_WARNS("Messaging") << "Malformed inventory offer from object" << LL_ENDL;
+					delete info;
 					break;
 				}
 				info->mType = (LLAssetType::EType) binary_bucket[0];
diff --git a/indra/newview/llviewernetwork.cpp b/indra/newview/llviewernetwork.cpp
index d7b55d7e978ef571c951f87edd9374ee3d761dec..987d23630a9e49b0d1b054beccb9e31346329185 100644
--- a/indra/newview/llviewernetwork.cpp
+++ b/indra/newview/llviewernetwork.cpp
@@ -169,6 +169,7 @@ void LLViewerLogin::setGridChoice(EGridInfo grid)
 	if(grid < 0 || grid >= GRID_INFO_COUNT)
 	{
 		llerrs << "Invalid grid index specified." << llendl;
+		return;
 	}
 
 	if(mGridChoice != grid || gSavedSettings.getS32("ServerChoice") != grid)
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index 3c79045cc588c6a72ec49a89cbf8bdfe3c0fa00a..886f1d9ef54fa35e62cb156ba0c688d85430b80c 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -861,6 +861,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
 					htonmemcpy(collision_plane.mV, &data[count], MVT_LLVector4, sizeof(LLVector4));
 					((LLVOAvatar*)this)->setFootPlane(collision_plane);
 					count += sizeof(LLVector4);
+					// fall through
 				case 60:
 					this_update_precision = 32;
 					// this is a terse update
@@ -900,6 +901,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
 					htonmemcpy(collision_plane.mV, &data[count], MVT_LLVector4, sizeof(LLVector4));
 					((LLVOAvatar*)this)->setFootPlane(collision_plane);
 					count += sizeof(LLVector4);
+					// fall through
 				case 32:
 					this_update_precision = 16;
 					test_pos_parent.quantize16(-0.5f*size, 1.5f*size, MIN_HEIGHT, MAX_HEIGHT);
@@ -1172,6 +1174,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
 					htonmemcpy(collision_plane.mV, &data[count], MVT_LLVector4, sizeof(LLVector4));
 					((LLVOAvatar*)this)->setFootPlane(collision_plane);
 					count += sizeof(LLVector4);
+					// fall through
 				case 60:
 					// this is a terse 32 update
 					// pos
@@ -1211,6 +1214,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
 					htonmemcpy(collision_plane.mV, &data[count], MVT_LLVector4, sizeof(LLVector4));
 					((LLVOAvatar*)this)->setFootPlane(collision_plane);
 					count += sizeof(LLVector4);
+					// fall through
 				case 32:
 					// this is a terse 16 update
 					this_update_precision = 16;
diff --git a/indra/newview/llviewerpartsim.cpp b/indra/newview/llviewerpartsim.cpp
index 841a7ccc5e88439a088e0cf826463fcadb3d08d2..6b480ccf8e5aeff3299757effdf4fd7080c5ffc3 100644
--- a/indra/newview/llviewerpartsim.cpp
+++ b/indra/newview/llviewerpartsim.cpp
@@ -81,6 +81,7 @@ F32 calc_desired_size(LLViewerCamera* camera, LLVector3 pos, LLVector2 scale)
 LLViewerPart::LLViewerPart() :
 	mPartID(0),
 	mLastUpdateTime(0.f),
+	mSkipOffset(0.f),
 	mVPCallback(NULL),
 	mImagep(NULL)
 {
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index 6dc9f5c4652fd2a33f91fcc427143e175622dcc7..86b1a8c9100c5094a32c6b36861881e636eb834a 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -135,7 +135,8 @@ LLGLSLShader			gLuminanceGatherProgram;
 GLint				gAvatarMatrixParam;
 
 LLViewerShaderMgr::LLViewerShaderMgr() :
-	mVertexShaderLevel(SHADER_COUNT, 0)
+	mVertexShaderLevel(SHADER_COUNT, 0),
+	mMaxAvatarShaderLevel(0)
 {	
 	/// Make sure WL Sky is the first program
 	mShaderList.push_back(&gWLSkyProgram);
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index b80dc7d90255b3dee7bc400fee2cef3b81271295..0ad269392d178f2c31c72271c9ec4759c768e3d0 100644
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -1029,6 +1029,8 @@ void LLViewerFetchedTexture::init(bool firstinit)
 	// does not contain this image.
 	mIsMissingAsset = FALSE;
 
+	mLoadedCallbackDesiredDiscardLevel = 0;
+
 	mNeedsCreateTexture = FALSE;
 	
 	mIsRawImageValid = FALSE;
@@ -1041,6 +1043,7 @@ void LLViewerFetchedTexture::init(bool firstinit)
 	mFetchPriority = 0;
 	mDownloadProgress = 0.f;
 	mFetchDeltaTime = 999999.f;
+	mRequestDeltaTime = 0.f;
 	mForSculpt = FALSE ;
 	mIsFetched = FALSE ;
 
diff --git a/indra/newview/llviewervisualparam.cpp b/indra/newview/llviewervisualparam.cpp
index b088ef073055aec203f9e9e8ac8b8f7a92ca5eb5..fad398e00b2dede9191a1ca38e1ec36ffbf053ab 100644
--- a/indra/newview/llviewervisualparam.cpp
+++ b/indra/newview/llviewervisualparam.cpp
@@ -46,6 +46,7 @@
 LLViewerVisualParamInfo::LLViewerVisualParamInfo()
 	:
 	mWearableType( WT_INVALID ),
+	mCrossWearable(FALSE),
 	mCamDist( 0.5f ),
 	mCamAngle( 0.f ),
 	mCamElevation( 0.f ),
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index c1817496b143bcbff17f60193937c8accaa8a3a1..b4c73dba262a65c247d159f6cd9824deff243c39 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -1659,6 +1659,9 @@ LLViewerWindow::~LLViewerWindow()
 {
 	llinfos << "Destroying Window" << llendl;
 	destroyWindow();
+
+	delete mDebugText;
+	mDebugText = NULL;
 }
 
 
@@ -4846,10 +4849,10 @@ LLPickInfo::LLPickInfo()
 }
 
 LLPickInfo::LLPickInfo(const LLCoordGL& mouse_pos, 
-						MASK keyboard_mask, 
-						BOOL pick_transparent,
-						BOOL pick_uv_coords,
-						void (*pick_callback)(const LLPickInfo& pick_info))
+		       MASK keyboard_mask, 
+		       BOOL pick_transparent,
+		       BOOL pick_uv_coords,
+		       void (*pick_callback)(const LLPickInfo& pick_info))
 	: mMousePt(mouse_pos),
 	  mKeyMask(keyboard_mask),
 	  mPickCallback(pick_callback),
diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h
index b488276a18e07073a4be86fd75e9336270a2dd99..c0a9180b53030656009b9d4a079f67f15c915f1e 100644
--- a/indra/newview/llviewerwindow.h
+++ b/indra/newview/llviewerwindow.h
@@ -126,9 +126,6 @@ class LLPickInfo
 	void			updateXYCoords();
 
 	BOOL			mWantSurfaceInfo;   // do we populate mUVCoord, mNormal, mBinormal?
-	U8				mPickBuffer[PICK_DIAMETER * PICK_DIAMETER * 4];
-	F32				mPickDepthBuffer[PICK_DIAMETER * PICK_DIAMETER];
-	BOOL			mPickParcelWall;
 
 };
 
diff --git a/indra/newview/llviewerwindowlistener.cpp b/indra/newview/llviewerwindowlistener.cpp
index de5778827112fa732d9ba75e61b562ddc6ac0291..fae98cf49aea44bd2351d9c2e46b90cd72ce6d10 100644
--- a/indra/newview/llviewerwindowlistener.cpp
+++ b/indra/newview/llviewerwindowlistener.cpp
@@ -77,6 +77,7 @@ void LLViewerWindowListener::saveSnapshot(const LLSD& event) const
         {
             LL_ERRS("LLViewerWindowListener") << "LLViewerWindowListener::saveSnapshot(): "
                                               << "unrecognized type " << event["type"] << LL_ENDL;
+	    return;
         }
         type = found->second;
     }
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 295c0c801092f6b6da0394139dbb4f33cee29135..bfe38c14ba952530b90837f16a02b577dd59e5e3 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -180,8 +180,10 @@ LLVOVolume::LLVOVolume(const LLUUID &id, const LLPCode pcode, LLViewerRegion *re
 	mRelativeXform.setIdentity();
 	mRelativeXformInvTrans.setIdentity();
 
+	mFaceMappingChanged = FALSE;
 	mLOD = MIN_LOD;
 	mTextureAnimp = NULL;
+	mVolumeChanged = FALSE;
 	mVObjRadius = LLVector3(1,1,0.5f).length();
 	mNumFaces = 0;
 	mLODChanged = FALSE;
diff --git a/indra/newview/llwearable.cpp b/indra/newview/llwearable.cpp
index b789bd3650af03ed6b00e0f57ee3426cbdcb15af..d093031beae1fc786e92d29e350c694531a6a63e 100644
--- a/indra/newview/llwearable.cpp
+++ b/indra/newview/llwearable.cpp
@@ -818,16 +818,13 @@ const LLLocalTextureObject* LLWearable::getConstLocalTextureObject(S32 index) co
 	return NULL;
 }
 
-void LLWearable::setLocalTextureObject(S32 index, LLLocalTextureObject *lto)
+void LLWearable::setLocalTextureObject(S32 index, LLLocalTextureObject &lto)
 {
 	if( mTEMap.find(index) != mTEMap.end() )
 	{
 		mTEMap.erase(index);
 	}
-	if( lto )
-	{
-		mTEMap[index] = new LLLocalTextureObject(*lto);
-	}
+	mTEMap[index] = new LLLocalTextureObject(lto);
 }
 
 
diff --git a/indra/newview/llwearable.h b/indra/newview/llwearable.h
index 7a579b248e6a5b05acb4e08042ff1f287e794045..dae983bcf33787b1f59dd10c660c57edae02c0a5 100644
--- a/indra/newview/llwearable.h
+++ b/indra/newview/llwearable.h
@@ -114,7 +114,7 @@ class LLWearable
 	LLLocalTextureObject* getLocalTextureObject(S32 index);
 	const LLLocalTextureObject* getConstLocalTextureObject(S32 index) const;
 
-	void				setLocalTextureObject(S32 index, LLLocalTextureObject *lto);
+	void				setLocalTextureObject(S32 index, LLLocalTextureObject &lto);
 	void				addVisualParam(LLVisualParam *param);
 	void				setVisualParams();
 	void 				setVisualParamWeight(S32 index, F32 value, BOOL upload_bake);