summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2017-09-02 23:58:19 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-09-03 10:11:58 +0200
commit09ae0a74bb946bc64fbc76082a52064a36ee9b01 (patch)
tree244b6004ab1c78c7723585eb6932104703daf768 /include
parente0883b6f6a1018d6d7538fc9ddeca3f623918b48 (diff)
Fix leak BacktraceState (enable-dbgutil)
buffer is created from sal/osl/unx/backtraceapi.cxx with: 70 auto b1 = new void *[maxDepth]; 71 int n = backtrace(b1, static_cast<int>(maxDepth)); 72 return std::unique_ptr<BacktraceState>(new BacktraceState{ b1, n }); and from sal/osl/w32/backtrace.cxx with: 79 auto pStack = new void *[maxDepth]; 80 // https://msdn.microsoft.com/en-us/library/windows/desktop/bb204633.aspx 81 // "CaptureStackBackTrace function" claims that you "can capture up to 82 // MAXUSHORT frames", and on Windows Server 2003 and Windows XP it even 83 // "must be less than 63", but assume that a too large input value is 84 // clamped internally, instead of resulting in an error: 85 int nFrames = CaptureStackBackTrace( 0, static_cast<ULONG>(maxDepth), pStack, nullptr ); 86 87 return std::unique_ptr<BacktraceState>(new BacktraceState{ pStack, nFrames }); Introduced with: https://cgit.freedesktop.org/libreoffice/core/commit/?id=bc9a2ba677ce3fcd46c2bbef6e8faeacb14292c1 Change-Id: Iea0528f5d2b38ff1f3dc4bd50ff035bb100ab981 Reviewed-on: https://gerrit.libreoffice.org/41854 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r--include/sal/backtrace.hxx1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/sal/backtrace.hxx b/include/sal/backtrace.hxx
index 2c854e102eef..f437a3b73620 100644
--- a/include/sal/backtrace.hxx
+++ b/include/sal/backtrace.hxx
@@ -29,6 +29,7 @@
struct BacktraceState {
void** buffer;
int nDepth;
+ ~BacktraceState() {delete[] buffer;}
};
SAL_DLLPUBLIC std::unique_ptr<BacktraceState> SAL_CALL sal_backtrace_get(