kern/138378: Memory leak in hfsc_class_modify() in file
sys/contrib/altq/altq/altq_hfsc.c
Patroklos Argyroudis
argp at census-labs.com
Mon Aug 31 10:00:17 UTC 2009
>Number: 138378
>Category: kern
>Synopsis: Memory leak in hfsc_class_modify() in file sys/contrib/altq/altq/altq_hfsc.c
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Mon Aug 31 10:00:16 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator: Patroklos Argyroudis
>Release: 8.0-CURRENT
>Organization:
census, inc
>Environment:
N/A
>Description:
There is a memory leak of pointers rsc_tmp and fsc_tmp if the allocations in lines 1810 and 1817 fail.
>How-To-Repeat:
N/A
>Fix:
Patch attached.
Patch attached with submission follows:
--- ./sys/contrib/altq/altq/altq_hfsc.c.orig 2009-08-27 17:24:01.000000000 +0300
+++ ./sys/contrib/altq/altq/altq_hfsc.c 2009-08-27 17:26:39.000000000 +0300
@@ -1809,15 +1809,20 @@
cl->cl_fsc == NULL) {
fsc_tmp = malloc(sizeof(struct internal_sc),
M_DEVBUF, M_WAITOK);
- if (fsc_tmp == NULL)
+ if (fsc_tmp == NULL) {
+ free(rsc_tmp);
return (ENOMEM);
+ }
}
if (usc != NULL && (usc->m1 != 0 || usc->m2 != 0) &&
cl->cl_usc == NULL) {
usc_tmp = malloc(sizeof(struct internal_sc),
M_DEVBUF, M_WAITOK);
- if (usc_tmp == NULL)
+ if (usc_tmp == NULL) {
+ free(rsc_tmp);
+ free(fsc_tmp);
return (ENOMEM);
+ }
}
cur_time = read_machclk();
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list