mount: memory leak on path overflow

changed goto out -> out_err, so the root is freed on buffer overflow
updated error messages for nfs41_root_create() and nfs41_root_mount_addrs()
if the root lookup fails, return ERROR_BAD_NETPATH instead of ERROR_FILE_NOT_FOUND

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
This commit is contained in:
Casey Bodley 2011-01-06 16:07:58 -05:00
parent 229ec94c5c
commit 7ccdf2ba47

View file

@ -70,7 +70,7 @@ static int handle_mount(nfs41_upcall *upcall)
NFS41_MAX_FILEIO_SIZE + WRITE_OVERHEAD,
NFS41_MAX_FILEIO_SIZE + READ_OVERHEAD, &root);
if (status) {
eprintf("nfs41_rpc_clnt_create failed %d\n", status);
eprintf("nfs41_root_create() failed %d\n", status);
goto out;
}
// add a mount
@ -79,7 +79,7 @@ static int handle_mount(nfs41_upcall *upcall)
status = nfs41_root_mount_addrs(root, &addrs, 0, 0, &client);
if (status) {
eprintf("nfs41_root_mount() failed with %d\n", status);
eprintf("nfs41_root_mount_addrs() failed with %d\n", status);
goto out_err;
}
@ -87,7 +87,7 @@ static int handle_mount(nfs41_upcall *upcall)
InitializeSRWLock(&path.lock);
if (FAILED(StringCchCopyA(path.path, NFS41_MAX_PATH_LEN, args->path))) {
status = ERROR_BUFFER_OVERFLOW;
goto out;
goto out_err;
}
path.len = (unsigned short)strlen(path.path);
@ -95,8 +95,8 @@ static int handle_mount(nfs41_upcall *upcall)
status = nfs41_lookup(root, client->session,
&path, NULL, NULL, NULL, NULL);
if (status) {
eprintf("nfs41_lookup('%s') failed with %d\n",
path.path, status);
eprintf("nfs41_lookup('%s') failed with %d\n", path.path, status);
status = ERROR_BAD_NETPATH;
goto out_err;
}