ded59d
From abcf8db7fa46b73fd5b8193ce11f9312301b84c7 Mon Sep 17 00:00:00 2001
ded59d
From: Andreas Schwab <schwab@suse.de>
ded59d
Date: Wed, 7 Jun 2023 11:21:48 +0200
ded59d
Subject: resolv_conf: release lock on allocation failure (bug 30527)
ded59d
ded59d
When the initial allocation of global fails, the local lock is left
ded59d
locked.
ded59d
ded59d
Reported by Steffen Lammel of SAP HANA development.
ded59d
ded59d
diff --git a/resolv/resolv_conf.c b/resolv/resolv_conf.c
ded59d
index bd5890773b..8bc9edc634 100644
ded59d
--- a/resolv/resolv_conf.c
ded59d
+++ b/resolv/resolv_conf.c
ded59d
@@ -93,7 +93,10 @@ get_locked_global (void)
ded59d
     {
ded59d
       global_copy = calloc (1, sizeof (*global));
ded59d
       if (global_copy == NULL)
ded59d
-        return NULL;
ded59d
+	{
ded59d
+	  __libc_lock_unlock (lock);
ded59d
+	  return NULL;
ded59d
+	}
ded59d
       atomic_store_relaxed (&global, global_copy);
ded59d
       resolv_conf_array_init (&global_copy->array);
ded59d
     }