[Scummvm-cvs-logs] SF.net SVN: scummvm:[54789] scummvm/trunk/engines/hugo
tdhs at users.sourceforge.net
tdhs at users.sourceforge.net
Sun Dec 5 23:02:05 CET 2010
Revision: 54789
http://scummvm.svn.sourceforge.net/scummvm/?rev=54789&view=rev
Author: tdhs
Date: 2010-12-05 22:02:04 +0000 (Sun, 05 Dec 2010)
Log Message:
-----------
HUGO: Partial Fix For Leaks from ReadPCX()
The shutdown() call has been reinstated, and freeObjects() now works without a double free and thus segfault, but this still misses some allocated resources...
Modified Paths:
--------------
scummvm/trunk/engines/hugo/hugo.cpp
scummvm/trunk/engines/hugo/object.cpp
Modified: scummvm/trunk/engines/hugo/hugo.cpp
===================================================================
--- scummvm/trunk/engines/hugo/hugo.cpp 2010-12-05 21:55:26 UTC (rev 54788)
+++ scummvm/trunk/engines/hugo/hugo.cpp 2010-12-05 22:02:04 UTC (rev 54789)
@@ -86,9 +86,7 @@
}
HugoEngine::~HugoEngine() {
- // FIXME - Need to call this to remove memory leaks,
- // but this currently causes double free issues.
- //shutdown();
+ shutdown();
freeTexts(_textData);
freeTexts(_stringtData);
Modified: scummvm/trunk/engines/hugo/object.cpp
===================================================================
--- scummvm/trunk/engines/hugo/object.cpp 2010-12-05 21:55:26 UTC (rev 54788)
+++ scummvm/trunk/engines/hugo/object.cpp 2010-12-05 22:02:04 UTC (rev 54789)
@@ -217,17 +217,31 @@
// Free all sequence lists and image data
for (int i = 0; i < _numObj; i++) {
object_t *obj = &_objects[i];
+ debugC(1, kDebugObject, "\tObject %d: %d Sequences", i, obj->seqNumb);
+
+ debugC(1, kDebugObject, "\tObject %d->currImagePtr: %p", i, (void *) obj->currImagePtr);
+ // FIXME - currImagePtr can be an alias into one of obj->seqList[].seqPtr so need to avoid freeing in that case.
+ //if (obj->currImagePtr != 0 && obj->currImagePtr != seq) {
+ // free(obj->currImagePtr);
+ // obj->currImagePtr = 0;
+ //}
+
for (int j = 0; j < obj->seqNumb; j++) { // for each sequence
+ debugC(1, kDebugObject, "\tSequence %d: seqlist %p", j, (void *) &obj->seqList[j]);
+ debugC(1, kDebugObject, "\tSequence %d: seqPtr %p", j, (void *) obj->seqList[j].seqPtr);
seq_t *seq = obj->seqList[j].seqPtr; // Free image
- if (obj->currImagePtr!= 0)
- free(obj->currImagePtr);
if (seq == 0) // Failure during database load
break;
do {
- free(seq->imagePtr);
+ debugC(1, kDebugObject, "\t\tseq->ImagePtr: %p", seq->imagePtr);
+ if (seq->imagePtr != 0) {
+ free(seq->imagePtr);
+ seq->imagePtr = 0;
+ }
seq = seq->nextSeqPtr;
} while (seq != obj->seqList[j].seqPtr);
free(seq); // Free sequence record
+ seq = 0;
}
}
}
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