Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Jan 2010 17:08:05 +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-7@freebsd.org
Subject:   svn commit: r202816 - stable/7/sys/kern
Message-ID:  <201001221708.o0MH85ib032055@svn.freebsd.org>

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

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

Modified:
  stable/7/sys/kern/kern_cpu.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/kern/kern_cpu.c
==============================================================================
--- stable/7/sys/kern/kern_cpu.c	Fri Jan 22 17:03:49 2010	(r202815)
+++ stable/7/sys/kern/kern_cpu.c	Fri Jan 22 17:08:05 2010	(r202816)
@@ -926,8 +926,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)
@@ -965,8 +967,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?201001221708.o0MH85ib032055>