Hi, I get a segmentation fault when I try to delete a library. Could someone please have a look over this code segment and tell me if there's something obviously wrong?

There's a syntax-highlighted version with other functions that use the std::list here : http://pastebin.com/m4bf43d62

Code:
void Application::freeComponent( char* componentID ){

	Library* deadLibrary = NULL;
	//Iterate through libraries and delete the component that matches the argument
	for( std::list<Library*>::iterator i = Libraries.begin(); i != Libraries.end(); ++i )
		if( strcmp( (*i)->ComponentFactory->getComponentID(), componentID ) == 0 ){
			log << "Freeing Component: " << componentID << "...";
			
			if( (*i)->ComponentFactory->isActive ){
				log << "[ERROR] Cannot free " << componentID << ": Component in-use." << write;
				return;
			} else {
				deadLibrary = *i;
			}	
		}
	
	if( deadLibrary ){
	
		Libraries.remove( deadLibrary );
		delete deadLibrary;
		log << "Done." << write;
		return;
	}
	
	log << "Cannot free " << componentID << ":  Component isn't loaded." << write;
	return;
}