summaryrefslogtreecommitdiff
path: root/pflocal/connq.c
diff options
context:
space:
mode:
Diffstat (limited to 'pflocal/connq.c')
-rw-r--r--pflocal/connq.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/pflocal/connq.c b/pflocal/connq.c
index 862c9a14..2b8d68a4 100644
--- a/pflocal/connq.c
+++ b/pflocal/connq.c
@@ -108,6 +108,20 @@ connq_create (struct connq **cq)
*cq = new;
return 0;
}
+
+/* Destroy a queue. */
+void
+connq_destroy (struct connq *cq)
+{
+ /* Everybody in the queue should hold a reference to the socket
+ containing the queue. */
+ assert (cq->length == 0);
+ /* Nevertheless, malloc(0) or realloc(0) might allocate some small
+ space. */
+ if (cq->queue)
+ free (cq->queue);
+ free (cq);
+}
/* ---------------------------------------------------------------- */