diff options
author | Adriaan de Jong <dejong@fox-it.com> | 2012-02-05 12:51:25 +0100 |
---|---|---|
committer | David Sommerseth <davids@redhat.com> | 2012-02-05 13:01:24 +0100 |
commit | bee92b479414d12035b0422f81ac5fcfe14fa645 (patch) | |
tree | b7943f57e36fda915b3bf5e6da213a15fc2eb6e4 /buffer.c | |
parent | 2b7deeb6632582fcfb23492e77bb09395d1be4ca (diff) | |
download | openvpn-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.c | 29 |
1 files changed, 10 insertions, 19 deletions
@@ -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 |