Guard against freeing NULL if vfs_mountroot_try is called with NULL

as an argument (this is legal to make other code simpler).
This commit is contained in:
Mike Smith 1999-11-05 19:28:07 +00:00
parent fd9ec25aaa
commit c161a8754f
2 changed files with 8 additions and 4 deletions

View File

@ -199,8 +199,10 @@ vfs_mountroot_try(char *mountfrom)
error = VFS_MOUNT(mp, NULL, NULL, NULL, curproc);
done:
free(vfsname, M_MOUNT);
free(path, M_MOUNT);
if (vfsname != NULL)
free(vfsname, M_MOUNT);
if (path != NULL)
free(path, M_MOUNT);
if (error != 0) {
if (mp != NULL)
free(mp, M_MOUNT);

View File

@ -199,8 +199,10 @@ vfs_mountroot_try(char *mountfrom)
error = VFS_MOUNT(mp, NULL, NULL, NULL, curproc);
done:
free(vfsname, M_MOUNT);
free(path, M_MOUNT);
if (vfsname != NULL)
free(vfsname, M_MOUNT);
if (path != NULL)
free(path, M_MOUNT);
if (error != 0) {
if (mp != NULL)
free(mp, M_MOUNT);