91 lines
2.0 KiB
Diff
91 lines
2.0 KiB
Diff
|
From 076ad04668ff689b023166931edca6fa03530bf9 Mon Sep 17 00:00:00 2001
|
||
|
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
|
||
|
Date: Sat, 12 Jan 2013 16:27:37 +0100
|
||
|
Subject: [PATCH 099/364] * grub-core/lib/libgcrypt_wrap/mem.c
|
||
|
(gcry_x*alloc): Make out of memory fatal.
|
||
|
|
||
|
---
|
||
|
ChangeLog | 5 +++++
|
||
|
grub-core/lib/libgcrypt_wrap/mem.c | 30 +++++++++++++++++++++++++-----
|
||
|
2 files changed, 30 insertions(+), 5 deletions(-)
|
||
|
|
||
|
diff --git a/ChangeLog b/ChangeLog
|
||
|
index 8a16591..4ac0aa6 100644
|
||
|
--- a/ChangeLog
|
||
|
+++ b/ChangeLog
|
||
|
@@ -1,5 +1,10 @@
|
||
|
2013-01-12 Vladimir Serbinenko <phcoder@gmail.com>
|
||
|
|
||
|
+ * grub-core/lib/libgcrypt_wrap/mem.c (gcry_x*alloc): Make out of memory
|
||
|
+ fatal.
|
||
|
+
|
||
|
+2013-01-12 Vladimir Serbinenko <phcoder@gmail.com>
|
||
|
+
|
||
|
* grub-core/lib/libgcrypt_wrap/mem.c (_gcry_log_bug): Make gcrypt bugs
|
||
|
fatal.
|
||
|
|
||
|
diff --git a/grub-core/lib/libgcrypt_wrap/mem.c b/grub-core/lib/libgcrypt_wrap/mem.c
|
||
|
index 64e8b62..94f9d65 100644
|
||
|
--- a/grub-core/lib/libgcrypt_wrap/mem.c
|
||
|
+++ b/grub-core/lib/libgcrypt_wrap/mem.c
|
||
|
@@ -35,31 +35,51 @@ gcry_is_secure (const void *a __attribute__ ((unused)))
|
||
|
void *
|
||
|
gcry_xcalloc (size_t n, size_t m)
|
||
|
{
|
||
|
- return grub_zalloc (n * m);
|
||
|
+ void *ret;
|
||
|
+ ret = grub_zalloc (n * m);
|
||
|
+ if (!ret)
|
||
|
+ grub_fatal ("gcry_xcalloc failed");
|
||
|
+ return ret;
|
||
|
}
|
||
|
|
||
|
void *
|
||
|
gcry_xmalloc_secure (size_t n)
|
||
|
{
|
||
|
- return grub_malloc (n);
|
||
|
+ void *ret;
|
||
|
+ ret = grub_malloc (n);
|
||
|
+ if (!ret)
|
||
|
+ grub_fatal ("gcry_xmalloc failed");
|
||
|
+ return ret;
|
||
|
}
|
||
|
|
||
|
void *
|
||
|
gcry_xcalloc_secure (size_t n, size_t m)
|
||
|
{
|
||
|
- return grub_zalloc (n * m);
|
||
|
+ void *ret;
|
||
|
+ ret = grub_zalloc (n * m);
|
||
|
+ if (!ret)
|
||
|
+ grub_fatal ("gcry_xcalloc failed");
|
||
|
+ return ret;
|
||
|
}
|
||
|
|
||
|
void *
|
||
|
gcry_xmalloc (size_t n)
|
||
|
{
|
||
|
- return grub_malloc (n);
|
||
|
+ void *ret;
|
||
|
+ ret = grub_malloc (n);
|
||
|
+ if (!ret)
|
||
|
+ grub_fatal ("gcry_xmalloc failed");
|
||
|
+ return ret;
|
||
|
}
|
||
|
|
||
|
void *
|
||
|
gcry_xrealloc (void *a, size_t n)
|
||
|
{
|
||
|
- return grub_realloc (a, n);
|
||
|
+ void *ret;
|
||
|
+ ret = grub_realloc (a, n);
|
||
|
+ if (!ret)
|
||
|
+ grub_fatal ("gcry_xrealloc failed");
|
||
|
+ return ret;
|
||
|
}
|
||
|
|
||
|
void
|
||
|
--
|
||
|
1.8.1.4
|
||
|
|