svn commit: r198952 - head/sys/contrib/altq/altq
Christian Brueffer
brueffer at FreeBSD.org
Thu Nov 5 16:30:16 UTC 2009
Author: brueffer
Date: Thu Nov 5 16:30:16 2009
New Revision: 198952
URL: http://svn.freebsd.org/changeset/base/198952
Log:
Fix two memory leaks in error cases.
PR: 138378
Submitted by: Patroklos Argyroudis <argp at census-labs.com>
Approved by: mlaier
MFC after: 1 week
Modified:
head/sys/contrib/altq/altq/altq_hfsc.c
Modified: head/sys/contrib/altq/altq/altq_hfsc.c
==============================================================================
--- head/sys/contrib/altq/altq/altq_hfsc.c Thu Nov 5 16:16:56 2009 (r198951)
+++ head/sys/contrib/altq/altq/altq_hfsc.c Thu Nov 5 16:30:16 2009 (r198952)
@@ -1809,15 +1809,20 @@ hfsc_class_modify(cl, rsc, fsc, usc)
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();
More information about the svn-src-all
mailing list