Date: Mon, 2 Feb 2009 19:22:53 +0000 (UTC) From: Ulf Lilleengen <lulf@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r188017 - head/sbin/geom/core Message-ID: <200902021922.n12JMrM8005192@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: lulf Date: Mon Feb 2 19:22:53 2009 New Revision: 188017 URL: http://svn.freebsd.org/changeset/base/188017 Log: - Use a separate pointer to the allocated memory for freeing, as strsep may modify the pointer argument passed to it. This triggered an assert in malloc when a geom command being run under the livefs environment. PR: bin/130632 Submitted by: Dimitry Andric <dimitry -at- andric.com> Pointy hat to: me MFC after: 2 days Modified: head/sbin/geom/core/geom.c Modified: head/sbin/geom/core/geom.c ============================================================================== --- head/sbin/geom/core/geom.c Mon Feb 2 18:32:41 2009 (r188016) +++ head/sbin/geom/core/geom.c Mon Feb 2 19:22:53 2009 (r188017) @@ -487,13 +487,13 @@ library_path(void) static void load_library(void) { - char *curpath, path[MAXPATHLEN], *totalpath; + char *curpath, path[MAXPATHLEN], *tofree, *totalpath; uint32_t *lib_version; void *dlh; int ret; ret = 0; - totalpath = strdup(library_path()); + tofree = totalpath = strdup(library_path()); if (totalpath == NULL) err(EXIT_FAILURE, "Not enough memory for library path"); @@ -519,7 +519,7 @@ load_library(void) } break; } - free(totalpath); + free(tofree); /* No library was found, but standard commands can still be used */ if (ret == -1) return;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200902021922.n12JMrM8005192>