Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Nov 2009 13:37:27 +0000 (UTC)
From:      Christian Brueffer <brueffer@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r199375 - stable/8/sys/contrib/altq/altq
Message-ID:  <200911171337.nAHDbR1S008959@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: brueffer
Date: Tue Nov 17 13:37:27 2009
New Revision: 199375
URL: http://svn.freebsd.org/changeset/base/199375

Log:
  MFC: r198952
  
  Fix two memory leaks in error cases.

Modified:
  stable/8/sys/contrib/altq/altq/altq_hfsc.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/netinet6/   (props changed)

Modified: stable/8/sys/contrib/altq/altq/altq_hfsc.c
==============================================================================
--- stable/8/sys/contrib/altq/altq/altq_hfsc.c	Tue Nov 17 13:36:21 2009	(r199374)
+++ stable/8/sys/contrib/altq/altq/altq_hfsc.c	Tue Nov 17 13:37:27 2009	(r199375)
@@ -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();



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200911171337.nAHDbR1S008959>