resolv_conf: release lock on allocation failure (bug 30527)

When the initial allocation of global fails, the local lock is left
locked.

Reported by Steffen Lammel of SAP HANA development.
This commit is contained in:
Andreas Schwab 2023-06-07 11:21:48 +02:00
parent 85e6d8b417
commit abcf8db7fa

View File

@ -93,7 +93,10 @@ get_locked_global (void)
{
global_copy = calloc (1, sizeof (*global));
if (global_copy == NULL)
return NULL;
{
__libc_lock_unlock (lock);
return NULL;
}
atomic_store_relaxed (&global, global_copy);
resolv_conf_array_init (&global_copy->array);
}