summaryrefslogtreecommitdiff
path: root/sys/altq
diff options
context:
space:
mode:
authorKenjiro Cho <kjc@cvs.openbsd.org>2003-03-24 07:33:29 +0000
committerKenjiro Cho <kjc@cvs.openbsd.org>2003-03-24 07:33:29 +0000
commit6d65234c8f9abf6bc954783b24537be241ee47c3 (patch)
tree584a1da832d46bfb52f005b229f58ad97cc3ae34 /sys/altq
parentf81222aaef71e6c2255e7c7340de3cf986f6d406 (diff)
fix error return values (NULL to ENOMEM) and add missing ellist_destroy()
in error handling of hfsc_add_altq(). report and fix by millert@
Diffstat (limited to 'sys/altq')
-rw-r--r--sys/altq/altq_hfsc.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/altq/altq_hfsc.c b/sys/altq/altq_hfsc.c
index 887cfa04caf..8b92e49d7e3 100644
--- a/sys/altq/altq_hfsc.c
+++ b/sys/altq/altq_hfsc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: altq_hfsc.c,v 1.12 2003/03/13 16:42:52 kjc Exp $ */
+/* $OpenBSD: altq_hfsc.c,v 1.13 2003/03/24 07:33:28 kjc Exp $ */
/* $KAME: altq_hfsc.c,v 1.17 2002/11/29 07:48:33 kjc Exp $ */
/*
@@ -157,13 +157,13 @@ hfsc_add_altq(struct pf_altq *a)
MALLOC(hif, struct hfsc_if *, sizeof(struct hfsc_if),
M_DEVBUF, M_WAITOK);
if (hif == NULL)
- return (NULL);
+ return (ENOMEM);
bzero(hif, sizeof(struct hfsc_if));
hif->hif_eligible = ellist_alloc();
if (hif->hif_eligible == NULL) {
FREE(hif, M_DEVBUF);
- return NULL;
+ return (ENOMEM);
}
hif->hif_ifq = &ifp->if_snd;
@@ -176,6 +176,7 @@ hfsc_add_altq(struct pf_altq *a)
root_sc.m2 = a->ifbandwidth;
if ((hif->hif_rootclass = hfsc_class_create(hif,
&root_sc, &root_sc, NULL, NULL, 0, 0, 0)) == NULL) {
+ ellist_destroy(hif->hif_eligible);
FREE(hif, M_DEVBUF);
return (ENOMEM);
}