There is a memory leak of pointers rsc_tmp and fsc_tmp if the allocations in lines 1810 and 1817 fail. Fix: Patch attached. Patch attached with submission follows: How-To-Repeat: N/A
Responsible Changed From-To: freebsd-bugs->freebsd-net Over to maintainer(s).
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@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(); _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
State Changed From-To: open->patched Committed, thanks!
Responsible Changed From-To: freebsd-net->brueffer MFC reminder.
State Changed From-To: patched->closed MFCs done.