include/sal/backtrace.hxx | 1 + 1 file changed, 1 insertion(+) New commits: commit 09ae0a74bb946bc64fbc76082a52064a36ee9b01 Author: Julien Nabet <serval2...@yahoo.fr> Date: Sat Sep 2 23:58:19 2017 +0200
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 <c...@libreoffice.org> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> 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( _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits