mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Immediate error on big memory allocations when --enable-debug.
This commit is contained in:
parent
c01f85420e
commit
034db45e26
@ -34,6 +34,12 @@ void *malloc_aux(size_t s, const char *file, int line)
|
||||
struct memblock *nb;
|
||||
size_t tsize = s + sizeof(*nb) + sizeof(unsigned long);
|
||||
|
||||
if (s > 50000000) {
|
||||
log_error("Huge memory allocation (size %" PRIuPTR
|
||||
") rejected - bug?", s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!(nb = malloc(tsize))) {
|
||||
log_error("couldn't allocate any memory, size = %" PRIuPTR, s);
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user