summaryrefslogtreecommitdiffstats
path: root/buffer.c
diff options
context:
space:
mode:
authorAdriaan de Jong <dejong@fox-it.com>2012-02-05 12:51:25 +0100
committerDavid Sommerseth <davids@redhat.com>2012-02-05 13:01:24 +0100
commitbee92b479414d12035b0422f81ac5fcfe14fa645 (patch)
treeb7943f57e36fda915b3bf5e6da213a15fc2eb6e4 /buffer.c
parent2b7deeb6632582fcfb23492e77bb09395d1be4ca (diff)
downloadopenvpn-bee92b479414d12035b0422f81ac5fcfe14fa645.tar.gz
openvpn-bee92b479414d12035b0422f81ac5fcfe14fa645.tar.xz
openvpn-bee92b479414d12035b0422f81ac5fcfe14fa645.zip
Removed support for calling gc_malloc with a NULL gc_arena struct
Signed-off-by: Adriaan de Jong <dejong@fox-it.com> Acked-by: David Sommerseth <davids@redhat.com> Signed-off-by: David Sommerseth <davids@redhat.com>
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/buffer.c b/buffer.c
index 2f8e4b8..c39bbcb 100644
--- a/buffer.c
+++ b/buffer.c
@@ -310,28 +310,19 @@ gc_malloc (size_t size, bool clear, struct gc_arena *a)
#endif
{
void *ret;
- if (a)
- {
- struct gc_entry *e;
-#ifdef DMALLOC
- e = (struct gc_entry *) openvpn_dmalloc (file, line, size + sizeof (struct gc_entry));
-#else
- e = (struct gc_entry *) malloc (size + sizeof (struct gc_entry));
-#endif
- check_malloc_return (e);
- ret = (char *) e + sizeof (struct gc_entry);
- e->next = a->list;
- a->list = e;
- }
- else
- {
+ ASSERT (NULL != a);
+
+ struct gc_entry *e;
#ifdef DMALLOC
- ret = openvpn_dmalloc (file, line, size);
+ e = (struct gc_entry *) openvpn_dmalloc (file, line, size + sizeof (struct gc_entry));
#else
- ret = malloc (size);
+ e = (struct gc_entry *) malloc (size + sizeof (struct gc_entry));
#endif
- check_malloc_return (ret);
- }
+ check_malloc_return (e);
+ ret = (char *) e + sizeof (struct gc_entry);
+ e->next = a->list;
+ a->list = e;
+
#ifndef ZERO_BUFFER_ON_ALLOC
if (clear)
#endif