Skip to content

Commit

Permalink
PRINCE: memory leak fixed in object
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamil Zbróg committed Nov 5, 2013
1 parent 3ed4e36 commit dfdff8d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 5 additions & 3 deletions engines/prince/object.cpp
Expand Up @@ -32,7 +32,11 @@

namespace Prince {

Object::Object() : _surface(NULL) {
Object::Object() : _surface(NULL), _x(0), _y(0), _z(0) {
}

Object::~Object() {
delete _surface;
}

void Object::loadSurface(Common::SeekableReadStream &stream) {
Expand All @@ -43,11 +47,9 @@ void Object::loadSurface(Common::SeekableReadStream &stream) {
for (int h = 0; h < _surface->h; ++h) {
stream.read(_surface->getBasePtr(0, h), _surface->w);
}

}

bool Object::loadFromStream(Common::SeekableReadStream &stream) {

int32 pos = stream.pos();
uint16 x = stream.readUint16LE();
if (x == 0xFFFF)
Expand Down
1 change: 1 addition & 0 deletions engines/prince/object.h
Expand Up @@ -31,6 +31,7 @@ namespace Prince {
class Object {
public:
Object();
~Object();

bool loadFromStream(Common::SeekableReadStream &stream);
Graphics::Surface *getSurface() const { return _surface; }
Expand Down

0 comments on commit dfdff8d

Please sign in to comment.