aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelen <jjelen@redhat.com>2018-12-10 10:52:14 +0100
committerAndreas Schneider <asn@cryptomilk.org>2018-12-10 17:52:56 +0100
commit48aede2a312b152e1ee28a665e62f30b08c28e81 (patch)
treeddc5e0e8a946b44b2a41cb5468e87e835ff26696
parentfe309ba43fb904da4385fc40a338ecc7482f8388 (diff)
downloadlibssh-48aede2a312b152e1ee28a665e62f30b08c28e81.tar.gz
libssh-48aede2a312b152e1ee28a665e62f30b08c28e81.tar.xz
libssh-48aede2a312b152e1ee28a665e62f30b08c28e81.zip
options: Check for null
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r--src/options.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/options.c b/src/options.c
index 81d02c91..3f0167d5 100644
--- a/src/options.c
+++ b/src/options.c
@@ -74,7 +74,7 @@ int ssh_options_copy(ssh_session src, ssh_session *dest) {
return -1;
}
- if (src->opts.username) {
+ if (src->opts.username != NULL) {
new->opts.username = strdup(src->opts.username);
if (new->opts.username == NULL) {
ssh_free(new);
@@ -82,7 +82,7 @@ int ssh_options_copy(ssh_session src, ssh_session *dest) {
}
}
- if (src->opts.host) {
+ if (src->opts.host != NULL) {
new->opts.host = strdup(src->opts.host);
if (new->opts.host == NULL) {
ssh_free(new);
@@ -90,9 +90,7 @@ int ssh_options_copy(ssh_session src, ssh_session *dest) {
}
}
- if (src->opts.identity) {
- struct ssh_iterator *it;
-
+ if (src->opts.identity != NULL) {
it = ssh_list_get_iterator(src->opts.identity);
while (it) {
char *id;
@@ -114,7 +112,7 @@ int ssh_options_copy(ssh_session src, ssh_session *dest) {
}
}
- if (src->opts.sshdir) {
+ if (src->opts.sshdir != NULL) {
new->opts.sshdir = strdup(src->opts.sshdir);
if (new->opts.sshdir == NULL) {
ssh_free(new);
@@ -122,7 +120,7 @@ int ssh_options_copy(ssh_session src, ssh_session *dest) {
}
}
- if (src->opts.knownhosts) {
+ if (src->opts.knownhosts != NULL) {
new->opts.knownhosts = strdup(src->opts.knownhosts);
if (new->opts.knownhosts == NULL) {
ssh_free(new);
@@ -131,7 +129,7 @@ int ssh_options_copy(ssh_session src, ssh_session *dest) {
}
for (i = 0; i < 10; i++) {
- if (src->opts.wanted_methods[i]) {
+ if (src->opts.wanted_methods[i] != NULL) {
new->opts.wanted_methods[i] = strdup(src->opts.wanted_methods[i]);
if (new->opts.wanted_methods[i] == NULL) {
ssh_free(new);
@@ -140,7 +138,7 @@ int ssh_options_copy(ssh_session src, ssh_session *dest) {
}
}
- if (src->opts.ProxyCommand) {
+ if (src->opts.ProxyCommand != NULL) {
new->opts.ProxyCommand = strdup(src->opts.ProxyCommand);
if (new->opts.ProxyCommand == NULL) {
ssh_free(new);