[Scummvm-git-logs] scummvm master -> deefffd983f440d4c2879c0637e1dd3103d31026
bluegr
bluegr at gmail.com
Wed May 12 11:10:30 UTC 2021
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
deefffd983 GRAPHICS: Fix leak in managed surface
Commit: deefffd983f440d4c2879c0637e1dd3103d31026
https://github.com/scummvm/scummvm/commit/deefffd983f440d4c2879c0637e1dd3103d31026
Author: Mathias Parnaudeau (mparnaudeau at optimum-software.fr)
Date: 2021-05-12T14:10:26+03:00
Commit Message:
GRAPHICS: Fix leak in managed surface
In the case of the ManagedSurface constructor from a Surface object,
_disposeAfterUse is not initialized. But more, copyFrom() sets
_disposeAfterUse to YES after allocation of buffer. And then,
after the call to copyFrom, _disposeAfterUse was set to NO, what
made the pixels buffer not freed.
Changed paths:
graphics/managed_surface.cpp
graphics/managed_surface.h
diff --git a/graphics/managed_surface.cpp b/graphics/managed_surface.cpp
index a02a68ad5f..7c4b21e880 100644
--- a/graphics/managed_surface.cpp
+++ b/graphics/managed_surface.cpp
@@ -101,8 +101,8 @@ ManagedSurface::ManagedSurface(const Surface *surf) :
return;
}
- copyFrom(*surf);
_disposeAfterUse = DisposeAfterUse::NO;
+ copyFrom(*surf);
}
ManagedSurface::~ManagedSurface() {
diff --git a/graphics/managed_surface.h b/graphics/managed_surface.h
index d9722f3e7c..891d00fd0a 100644
--- a/graphics/managed_surface.h
+++ b/graphics/managed_surface.h
@@ -136,7 +136,7 @@ public:
/**
* Create a managed surface from plain Surface.
*
- * If disiposeAgter use flag is set (default), the surface will reuse all structures
+ * If disposeAfterUse flag is set (default), the surface will reuse all structures
* from the surface and destroy it, otherwise it will make a copy.
*/
ManagedSurface(Surface *surf, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES);
@@ -161,7 +161,7 @@ public:
operator const Surface &() const { return _innerSurface; }
/**
- * Return the underyling Graphics::Surface
+ * Return the underlying Graphics::Surface
*
* If a caller uses the non-const surfacePtr version and changes
* the surface, they'll be responsible for calling addDirtyRect
@@ -610,7 +610,7 @@ public:
* @param dstFormat The desired format.
* @param palette The palette (in RGB888), if the source format has a bpp of 1.
*/
- void convertToInPlace(const PixelFormat &dstFormat, const byte *palette = 0) {
+ void convertToInPlace(const PixelFormat &dstFormat, const byte *palette = nullptr) {
_innerSurface.convertToInPlace(dstFormat, palette);
}
More information about the Scummvm-git-logs
mailing list