diff options
| author | Xavi Hernandez <xhernandez@redhat.com> | 2019-05-22 17:46:19 +0200 | 
|---|---|---|
| committer | Amar Tumballi <amarts@redhat.com> | 2019-05-26 13:59:13 +0000 | 
| commit | 5d88111a142b3c37e92bdd36699a04fd054d27f4 (patch) | |
| tree | 781cf006eb4a720dfaf3455b8f6b959b56901dc9 /xlators/protocol/client/src/client.c | |
| parent | 4c85456e38b9cc2d9698decca15a21e0cb7961a9 (diff) | |
Fix some "Null pointer dereference" coverity issues
This patch fixes the following CID's:
  * 1124829
  * 1274075
  * 1274083
  * 1274128
  * 1274135
  * 1274141
  * 1274143
  * 1274197
  * 1274205
  * 1274210
  * 1274211
  * 1288801
  * 1398629
Change-Id: Ia7c86cfab3245b20777ffa296e1a59748040f558
Updates: bz#789278
Signed-off-by: Xavi Hernandez <xhernandez@redhat.com>
Diffstat (limited to 'xlators/protocol/client/src/client.c')
| -rw-r--r-- | xlators/protocol/client/src/client.c | 7 | 
1 files changed, 6 insertions, 1 deletions
diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c index d7a0d1a1c9a..5aae09e6156 100644 --- a/xlators/protocol/client/src/client.c +++ b/xlators/protocol/client/src/client.c @@ -1232,9 +1232,12 @@ client_set_remote_options(char *value, xlator_t *this)      char *remote_port_str = NULL;      char *tmp = NULL;      int remote_port = 0; -    int ret = 0; +    int ret = -1;      dup_value = gf_strdup(value); +    if (dup_value == NULL) { +        goto out; +    }      host = strtok_r(dup_value, ":", &tmp);      subvol = strtok_r(NULL, ":", &tmp);      remote_port_str = strtok_r(NULL, ":", &tmp); @@ -1248,6 +1251,7 @@ client_set_remote_options(char *value, xlator_t *this)          if (ret) {              gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_SET_FAILED,                     "failed to set remote-host with %s", host); +            GF_FREE(host_dup);              goto out;          }      } @@ -1262,6 +1266,7 @@ client_set_remote_options(char *value, xlator_t *this)          if (ret) {              gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_SET_FAILED,                     "failed to set remote-host with %s", host); +            GF_FREE(subvol_dup);              goto out;          }      }  | 
