2
0
mirror of https://github.com/xcat2/xNBA.git synced 2024-11-25 11:00:15 +00:00

[nfs] Fix an invalid free() when loading a symlink

Signed-off-by: Marin Hannache <git@mareo.fr>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Marin Hannache 2014-03-12 16:26:24 +01:00 committed by Michael Brown
parent d42901c4ad
commit 7aa69c4d0d

View File

@ -145,6 +145,8 @@ static void nfs_done ( struct nfs_request *nfs, int rc ) {
DBGC ( nfs, "NFS_OPEN %p completed (%s)\n", nfs, strerror ( rc ) );
free ( nfs->filename );
intf_shutdown ( &nfs->xfer, rc );
intf_shutdown ( &nfs->pm_intf, rc );
intf_shutdown ( &nfs->mount_intf, rc );
@ -334,6 +336,15 @@ static int nfs_mount_deliver ( struct nfs_request *nfs,
goto done;
}
/* We need to strdup() nfs->filename since the code handling
* symlink resolution make the assumption that it can be
* free()ed. */
if ( ( nfs->filename = strdup ( nfs->filename ) ) == NULL )
{
rc = -ENOMEM;
goto err;
}
nfs->current_fh = mnt_reply.fh;
nfs->nfs_state = NFS_LOOKUP;
nfs_step ( nfs );