Author: lulf
Date: Wed Feb  4 17:35:21 2009
New Revision: 188116
URL: http://svn.freebsd.org/changeset/base/188116

Log:
  MFC r188017:
  - 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>

Modified:
  stable/7/sbin/geom/   (props changed)
  stable/7/sbin/geom/class/part/   (props changed)
  stable/7/sbin/geom/core/geom.c
  stable/7/sbin/geom/misc/   (props changed)

Modified: stable/7/sbin/geom/core/geom.c
==============================================================================
--- stable/7/sbin/geom/core/geom.c      Wed Feb  4 17:10:01 2009        
(r188115)
+++ stable/7/sbin/geom/core/geom.c      Wed Feb  4 17:35:21 2009        
(r188116)
@@ -480,13 +480,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");
 
@@ -512,7 +512,7 @@ load_library(void)
                }
                break;
        }
-       free(totalpath);
+       free(tofree);
        /* No library was found, but standard commands can still be used */
        if (ret == -1)
                return;
_______________________________________________
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-unsubscr...@freebsd.org"

Reply via email to