]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Removed support for calling gc_malloc with a NULL gc_arena struct
authorAdriaan de Jong <dejong@fox-it.com>
Sun, 5 Feb 2012 11:51:25 +0000 (12:51 +0100)
committerDavid Sommerseth <davids@redhat.com>
Sun, 5 Feb 2012 12:01:24 +0000 (13:01 +0100)
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>
buffer.c

index 2f8e4b880bee7fe0d3ea6db8eb9f4b49bf06c6b5..c39bbcbbb0cfb2aed5eea911af690b06a8d5f1a4 100644 (file)
--- 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