summaryrefslogtreecommitdiff
path: root/openvpn/src/openvpn/buffer.c
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2013-12-08 15:06:24 +0100
committerArne Schwabe <arne@rfc2549.org>2013-12-08 15:06:24 +0100
commitf5b64019421396f59654984838b567afd19b01cf (patch)
tree027d8908bcdc9cbe9f77aa1cf539c890b0e850ff /openvpn/src/openvpn/buffer.c
parentb2019aee1f081e5b1ae1ac56a54172cb2b98b8be (diff)
Update pre resolve patch
Diffstat (limited to 'openvpn/src/openvpn/buffer.c')
-rw-r--r--openvpn/src/openvpn/buffer.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/openvpn/src/openvpn/buffer.c b/openvpn/src/openvpn/buffer.c
index fb3b52d1..36611415 100644
--- a/openvpn/src/openvpn/buffer.c
+++ b/openvpn/src/openvpn/buffer.c
@@ -372,6 +372,44 @@ x_gc_free (struct gc_arena *a)
}
/*
+ * Functions to handle special objects in gc_entries
+ */
+
+void
+x_gc_freespecial (struct gc_arena *a)
+{
+ struct gc_entry_special *e;
+ e = a->list_special;
+ a->list_special = NULL;
+
+ while (e != NULL)
+ {
+ struct gc_entry_special *next = e->next;
+ e->free_fnc (e->addr);
+ free(e);
+ e = next;
+ }
+}
+
+void gc_addspecial (void *addr, void (free_function)(void*), struct gc_arena *a)
+{
+ ASSERT(a);
+ struct gc_entry_special *e;
+#ifdef DMALLOC
+ e = (struct gc_entry_special *) openvpn_dmalloc (file, line, sizeof (struct gc_entry_special));
+#else
+ e = (struct gc_entry_special *) malloc (sizeof (struct gc_entry_special));
+#endif
+ check_malloc_return (e);
+ e->free_fnc = free_function;
+ e->addr = addr;
+
+ e->next = a->list_special;
+ a->list_special = e;
+}
+
+
+/*
* Transfer src arena to dest, resetting src to an empty arena.
*/
void