about summary refs log tree commit diff
path: root/resolv
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@suse.de>2023-06-07 11:21:48 +0200
committerAndreas Schwab <schwab@suse.de>2023-06-07 12:44:25 +0200
commitabcf8db7fa46b73fd5b8193ce11f9312301b84c7 (patch)
tree31f0e70962fe7b942ee8868b3fdc3b97f0206026 /resolv
parent85e6d8b4175fcb195011a0a1bad37d6f3b2355db (diff)
downloadglibc-abcf8db7fa46b73fd5b8193ce11f9312301b84c7.tar.gz
glibc-abcf8db7fa46b73fd5b8193ce11f9312301b84c7.tar.xz
glibc-abcf8db7fa46b73fd5b8193ce11f9312301b84c7.zip
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.
Diffstat (limited to 'resolv')
-rw-r--r--resolv/resolv_conf.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/resolv/resolv_conf.c b/resolv/resolv_conf.c
index bd5890773b..8bc9edc634 100644
--- a/resolv/resolv_conf.c
+++ b/resolv/resolv_conf.c
@@ -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);
     }