summaryrefslogtreecommitdiffstats
path: root/usr.bin/grep/queue.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/grep/queue.c')
-rw-r--r--usr.bin/grep/queue.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/usr.bin/grep/queue.c b/usr.bin/grep/queue.c
index afcb827..1887888 100644
--- a/usr.bin/grep/queue.c
+++ b/usr.bin/grep/queue.c
@@ -1,4 +1,4 @@
-/* $NetBSD: queue.c,v 1.2 2011/02/16 01:31:33 joerg Exp $ */
+/* $NetBSD: queue.c,v 1.5 2011/08/31 16:24:57 plunky Exp $ */
/* $FreeBSD$ */
/*-
@@ -68,8 +68,11 @@ enqueue(struct str *x)
STAILQ_INSERT_TAIL(&queue, item, list);
- if (++count > Bflag)
- free(dequeue());
+ if (++count > Bflag) {
+ item = dequeue();
+ free(item->data.dat);
+ free(item);
+ }
}
static struct qentry *
@@ -92,7 +95,8 @@ printqueue(void)
struct qentry *item;
while ((item = dequeue()) != NULL) {
- printline(&item->data, '-', (regmatch_t *)NULL, 0);
+ printline(&item->data, '-', NULL, 0);
+ free(item->data.dat);
free(item);
}
}
@@ -102,6 +106,8 @@ clearqueue(void)
{
struct qentry *item;
- while ((item = dequeue()) != NULL)
+ while ((item = dequeue()) != NULL) {
+ free(item->data.dat);
free(item);
+ }
}
OpenPOWER on IntegriCloud