Hello, Krzysztof Piecuch, le lun. 26 août 2019 17:54:55 +0000, a ecrit: > - if (gethostbyname_r (host, &_he, hostent_data, sizeof hostent_data, > - &he, h_err) == 0) > + do { > + bufsize *= 2; > + hostent_data = realloc(hostent_data, bufsize); > + if (!hostent_data) > + err = ENOMEM;
When realloc fails, the previous buffer is not released, so you mustn't immediately overwrite hostent_data with the new pointer, but use an intermediate temporary variable. > + retval = gethostbyname_r (host, &_he, hostent_data, bufsize, > + &he, h_err); > + } while (!err && retval == ERANGE && bufsize < bufsizemax); The GNU Coding Style prefers to use err == 0. Also replace the two spaces with just one space. > else > err = EINVAL; This will overwrite the ENOMEM mentioned above. In the commit log, please not only mention why the commit, but also what it contains, see previous log entries for instance. Here you could have * ftpfs/host.c (lookup_server): Fix coding style. On ENOMEM of realloc, return ENOMEM instead of overwriting it with EINVAL. Samuel