mirror of
https://github.com/samba-team/samba.git
synced 2025-02-25 17:57:42 +03:00
libsmb: Simplify SMBC_add_cached_server()
ENOMEM is the only error condition we have Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
parent
64ea002960
commit
13187d1f6e
@ -66,37 +66,34 @@ SMBC_add_cached_server(SMBCCTX * context,
|
||||
|
||||
srvcache->server_name = SMB_STRDUP(server);
|
||||
if (!srvcache->server_name) {
|
||||
errno = ENOMEM;
|
||||
goto failed;
|
||||
goto nomem;
|
||||
}
|
||||
|
||||
srvcache->share_name = SMB_STRDUP(share);
|
||||
if (!srvcache->share_name) {
|
||||
errno = ENOMEM;
|
||||
goto failed;
|
||||
goto nomem;
|
||||
}
|
||||
|
||||
srvcache->workgroup = SMB_STRDUP(workgroup);
|
||||
if (!srvcache->workgroup) {
|
||||
errno = ENOMEM;
|
||||
goto failed;
|
||||
goto nomem;
|
||||
}
|
||||
|
||||
srvcache->username = SMB_STRDUP(username);
|
||||
if (!srvcache->username) {
|
||||
errno = ENOMEM;
|
||||
goto failed;
|
||||
goto nomem;
|
||||
}
|
||||
|
||||
DLIST_ADD(context->internal->server_cache, srvcache);
|
||||
return 0;
|
||||
|
||||
failed:
|
||||
nomem:
|
||||
SAFE_FREE(srvcache->server_name);
|
||||
SAFE_FREE(srvcache->share_name);
|
||||
SAFE_FREE(srvcache->workgroup);
|
||||
SAFE_FREE(srvcache->username);
|
||||
SAFE_FREE(srvcache);
|
||||
errno = ENOMEM;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user