[Scummvm-cvs-logs] SF.net SVN: scummvm:[55048] scummvm/trunk/backends/plugins/elf/elf-loader. cpp

bluddy at users.sourceforge.net bluddy at users.sourceforge.net
Sun Dec 26 21:44:20 CET 2010


Revision: 55048
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55048&view=rev
Author:   bluddy
Date:     2010-12-26 20:44:19 +0000 (Sun, 26 Dec 2010)

Log Message:
-----------
PLUGINS: fixed resource leak that caused PSP to crash

The leaky file handles didn't show up when debugging using the shell since that uses the Windows file handles, of which there are many more.

Modified Paths:
--------------
    scummvm/trunk/backends/plugins/elf/elf-loader.cpp

Modified: scummvm/trunk/backends/plugins/elf/elf-loader.cpp
===================================================================
--- scummvm/trunk/backends/plugins/elf/elf-loader.cpp	2010-12-26 20:14:04 UTC (rev 55047)
+++ scummvm/trunk/backends/plugins/elf/elf-loader.cpp	2010-12-26 20:44:19 UTC (rev 55048)
@@ -332,8 +332,11 @@
 	Elf32_Ehdr ehdr;
 	Elf32_Phdr phdr;
 
-	if (!readElfHeader(&ehdr))
+	if (!readElfHeader(&ehdr)) {
+		delete _file;
+		_file = 0;
 		return;
+	}
 	
 	ELFMemMan.trackPlugin(true);	// begin tracking the plugin size
 	
@@ -341,8 +344,11 @@
 	for (uint32 i = 0; i < ehdr.e_phnum; i++) {	
 		debug(2, "elfloader: Loading segment %d", i);
 
-		if (!readProgramHeaders(&ehdr, &phdr, i))
+		if (!readProgramHeaders(&ehdr, &phdr, i)) {
+			delete _file;
+			_file = 0;
 			return;
+		}
 
 		if (phdr.p_flags & PF_X) {	// check for executable, allocated segment
 			ELFMemMan.trackAlloc(phdr.p_align, phdr.p_memsz);
@@ -351,6 +357,8 @@
 	
 	ELFMemMan.trackPlugin(false);	// we're done tracking the plugin size
 
+	delete _file;
+	_file = 0;
 	// No need to track the symbol table sizes -- they get discarded
 }
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list