diff options
author | Ulf Lilleengen <lulf@FreeBSD.org> | 2009-02-02 19:22:53 +0000 |
---|---|---|
committer | Ulf Lilleengen <lulf@FreeBSD.org> | 2009-02-02 19:22:53 +0000 |
commit | 5d82438617a4d0383b008afdb331b90e7ecb1d76 (patch) | |
tree | 58c4e753d0740b29bf4fd5b1088d9fb7bf9107ac /sbin/geom/core | |
parent | 07217730853e94c10eefa616360b85f98871348a (diff) | |
download | src-5d82438617a4d0383b008afdb331b90e7ecb1d76.tar.gz src-5d82438617a4d0383b008afdb331b90e7ecb1d76.zip |
- 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
Notes
Notes:
svn path=/head/; revision=188017
Diffstat (limited to 'sbin/geom/core')
-rw-r--r-- | sbin/geom/core/geom.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sbin/geom/core/geom.c b/sbin/geom/core/geom.c index f0d82e8120f9..f7656dc712f9 100644 --- a/sbin/geom/core/geom.c +++ b/sbin/geom/core/geom.c @@ -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; |