mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-20 07:14:06 +00:00
- 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
This commit is contained in:
parent
0721773085
commit
5d82438617
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=188017
|
@ -487,13 +487,13 @@ library_path(void)
|
||||||
static void
|
static void
|
||||||
load_library(void)
|
load_library(void)
|
||||||
{
|
{
|
||||||
char *curpath, path[MAXPATHLEN], *totalpath;
|
char *curpath, path[MAXPATHLEN], *tofree, *totalpath;
|
||||||
uint32_t *lib_version;
|
uint32_t *lib_version;
|
||||||
void *dlh;
|
void *dlh;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
totalpath = strdup(library_path());
|
tofree = totalpath = strdup(library_path());
|
||||||
if (totalpath == NULL)
|
if (totalpath == NULL)
|
||||||
err(EXIT_FAILURE, "Not enough memory for library path");
|
err(EXIT_FAILURE, "Not enough memory for library path");
|
||||||
|
|
||||||
|
@ -519,7 +519,7 @@ load_library(void)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
free(totalpath);
|
free(tofree);
|
||||||
/* No library was found, but standard commands can still be used */
|
/* No library was found, but standard commands can still be used */
|
||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue