summaryrefslogtreecommitdiff
path: root/source4/client
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2012-12-13 14:11:29 +0100
committerGünther Deschner <gd@samba.org>2012-12-21 13:55:59 +0100
commit8631a9090bd22f5ce3036dd596a213dd9d8a67c4 (patch)
treec421c1fa007157d1cd625c9bd12f2fe25e631f7d /source4/client
parenta444bb95a270ca5b331041c11a7e785c1e0559b7 (diff)
downloadsamba-8631a9090bd22f5ce3036dd596a213dd9d8a67c4.tar.gz
samba-8631a9090bd22f5ce3036dd596a213dd9d8a67c4.tar.bz2
samba-8631a9090bd22f5ce3036dd596a213dd9d8a67c4.zip
s4-client: Check return codes in do_connect().
Found by Coverity. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Günther Deschner <gd@samba.org>
Diffstat (limited to 'source4/client')
-rw-r--r--source4/client/client.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/source4/client/client.c b/source4/client/client.c
index 1cd0e5d063..9985338477 100644
--- a/source4/client/client.c
+++ b/source4/client/client.c
@@ -3133,14 +3133,30 @@ static bool do_connect(struct smbclient_context *ctx,
if (strncmp(specified_share, "\\\\", 2) == 0 ||
strncmp(specified_share, "//", 2) == 0) {
- smbcli_parse_unc(specified_share, ctx, &server, &share);
+ bool ok;
+
+ ok = smbcli_parse_unc(specified_share, ctx, &server, &share);
+ if (!ok) {
+ d_printf("Failed to parse UNC\n");
+ talloc_free(ctx);
+ return false;
+ }
} else {
share = talloc_strdup(ctx, specified_share);
server = talloc_strdup(ctx, specified_server);
+ if (share == NULL || server == NULL) {
+ d_printf("Failed to allocate memory for server and share\n");
+ talloc_free(ctx);
+ return false;
+ }
}
ctx->remote_cur_dir = talloc_strdup(ctx, "\\");
-
+ if (ctx->remote_cur_dir == NULL) {
+ talloc_free(ctx);
+ return false;
+ }
+
status = smbcli_full_connection(ctx, &ctx->cli, server, ports,
share, NULL,
socket_options,