summaryrefslogtreecommitdiff
path: root/sal/rtl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-12-13 14:53:41 +0000
committerCaolán McNamara <caolanm@redhat.com>2011-12-13 14:54:29 +0000
commitedf90c212d8bfe6360a1e35eb4d7fbbf82ed33b4 (patch)
tree50a46b385ab2615687533368af0f027042b3950e /sal/rtl
parent6f678383994a582543cef1ce8b7b729d30245680 (diff)
warn about massive allocs
Diffstat (limited to 'sal/rtl')
-rw-r--r--sal/rtl/source/alloc_global.cxx7
1 files changed, 7 insertions, 0 deletions
diff --git a/sal/rtl/source/alloc_global.cxx b/sal/rtl/source/alloc_global.cxx
index 6cf7509a9058..59213a11a8ea 100644
--- a/sal/rtl/source/alloc_global.cxx
+++ b/sal/rtl/source/alloc_global.cxx
@@ -28,6 +28,7 @@
#include "alloc_impl.hxx"
#include "rtl/alloc.h"
+#include <sal/log.hxx>
#include <sal/macros.h>
#include <cassert>
@@ -295,6 +296,9 @@ void * SAL_CALL rtl_reallocateMemory_SYSTEM (void * p, sal_Size n)
void* SAL_CALL rtl_allocateMemory (sal_Size n) SAL_THROW_EXTERN_C()
{
+ SAL_WARN_IF(
+ n >= SAL_MAX_INT32, "sal",
+ "suspicious massive alloc " << n);
#if !defined(FORCE_SYSALLOC)
while (1)
{
@@ -315,6 +319,9 @@ void* SAL_CALL rtl_allocateMemory (sal_Size n) SAL_THROW_EXTERN_C()
void* SAL_CALL rtl_reallocateMemory (void * p, sal_Size n) SAL_THROW_EXTERN_C()
{
+ SAL_WARN_IF(
+ n >= SAL_MAX_INT32, "sal",
+ "suspicious massive alloc " << n);
#if !defined(FORCE_SYSALLOC)
while (1)
{