public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] resolv_conf: release lock on allocation failure (bug 30527)
@ 2023-06-07 10:48 Andreas Schwab
  0 siblings, 0 replies; only message in thread
From: Andreas Schwab @ 2023-06-07 10:48 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=abcf8db7fa46b73fd5b8193ce11f9312301b84c7

commit abcf8db7fa46b73fd5b8193ce11f9312301b84c7
Author: Andreas Schwab <schwab@suse.de>
Date:   Wed Jun 7 11:21:48 2023 +0200

    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.

Diff:
---
 resolv/resolv_conf.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

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);
     }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-06-07 10:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-07 10:48 [glibc] resolv_conf: release lock on allocation failure (bug 30527) Andreas Schwab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).