Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Jan 2010 17:03:49 +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: r202815 - stable/8/sys/kern
Message-ID:  <201001221703.o0MH3n3Z031022@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: brueffer
Date: Fri Jan 22 17:03:49 2010
New Revision: 202815
URL: http://svn.freebsd.org/changeset/base/202815

Log:
  MFC: r201848
  
  Free allocated sbufs before returning ENOMEM.

Modified:
  stable/8/sys/kern/kern_cpu.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)

Modified: stable/8/sys/kern/kern_cpu.c
==============================================================================
--- stable/8/sys/kern/kern_cpu.c	Fri Jan 22 17:02:07 2010	(r202814)
+++ stable/8/sys/kern/kern_cpu.c	Fri Jan 22 17:03:49 2010	(r202815)
@@ -935,8 +935,10 @@ cpufreq_levels_sysctl(SYSCTL_HANDLER_ARG
 	/* Get settings from the device and generate the output string. */
 	count = CF_MAX_LEVELS;
 	levels = malloc(count * sizeof(*levels), M_TEMP, M_NOWAIT);
-	if (levels == NULL)
+	if (levels == NULL) {
+		sbuf_delete(&sb);
 		return (ENOMEM);
+	}
 	error = CPUFREQ_LEVELS(sc->dev, levels, &count);
 	if (error) {
 		if (error == E2BIG)
@@ -974,8 +976,10 @@ cpufreq_settings_sysctl(SYSCTL_HANDLER_A
 	/* Get settings from the device and generate the output string. */
 	set_count = MAX_SETTINGS;
 	sets = malloc(set_count * sizeof(*sets), M_TEMP, M_NOWAIT);
-	if (sets == NULL)
+	if (sets == NULL) {
+		sbuf_delete(&sb);
 		return (ENOMEM);
+	}
 	error = CPUFREQ_DRV_SETTINGS(dev, sets, &set_count);
 	if (error)
 		goto out;



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