mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
(ftpfs_netrc_lookup): fix null check after dereference
...and simplify. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
e33a48fc95
commit
24c14153c5
@ -2429,12 +2429,10 @@ ftpfs_netrc_lookup (const char *host, char **login, char **pass)
|
|||||||
/* Look up in the cache first */
|
/* Look up in the cache first */
|
||||||
for (rupp = rup_cache; rupp != NULL; rupp = rupp->next)
|
for (rupp = rup_cache; rupp != NULL; rupp = rupp->next)
|
||||||
{
|
{
|
||||||
if (!strcmp (host, rupp->host))
|
if (strcmp (host, rupp->host) == 0)
|
||||||
{
|
{
|
||||||
if (rupp->login)
|
*login = g_strdup (rupp->login);
|
||||||
*login = g_strdup (rupp->login);
|
*pass = g_strdup (rupp->pass);
|
||||||
if (pass && rupp->pass)
|
|
||||||
*pass = g_strdup (rupp->pass);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user