diff options
Diffstat (limited to 'libglusterfs/src/common-utils.c')
| -rw-r--r-- | libglusterfs/src/common-utils.c | 10 | 
1 files changed, 7 insertions, 3 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c index 985e7580050..b6e4fbecf8a 100644 --- a/libglusterfs/src/common-utils.c +++ b/libglusterfs/src/common-utils.c @@ -3568,17 +3568,21 @@ gf_is_local_addr(char *hostname)      }      for (res = result; res != NULL; res = res->ai_next) { -        gf_msg_debug(this->name, 0, "%s ", get_ip_from_addrinfo(res, &ip)); +        get_ip_from_addrinfo(res, &ip); +        gf_msg_debug(this->name, 0, "%s ", ip);          if (ip) { -            found = gf_is_loopback_localhost(res->ai_addr, hostname) || -                    gf_interface_search(ip); +            found = (gf_is_loopback_localhost(res->ai_addr, hostname) || +                     gf_interface_search(ip));          }          if (found) {              GF_FREE(ip);              goto out;          }          GF_FREE(ip); +        /* the above free will not set ip to NULL, and hence, there is +           double free possible as the loop continues. set ip to NULL. */ +        ip = NULL;      }  out:  | 
