From c6f87be04ebaa54a85855700298946afc979cb72 Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Thu, 11 Apr 2013 20:19:17 +0000 Subject: Proper access of _THREAD_PRIVATE storage. Avoids a mem leak and reinit of resolver context for each resolver call for single threaded programs. With and ok tedu@ ok eric@ --- lib/libc/asr/asr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/libc/asr/asr.c b/lib/libc/asr/asr.c index 6d618eb774f..24e4a3a20ee 100644 --- a/lib/libc/asr/asr.c +++ b/lib/libc/asr/asr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asr.c,v 1.21 2013/04/01 20:41:12 eric Exp $ */ +/* $OpenBSD: asr.c,v 1.22 2013/04/11 20:19:16 otto Exp $ */ /* * Copyright (c) 2010-2012 Eric Faurot * @@ -161,7 +161,7 @@ async_resolver_done(struct asr *asr) struct asr **priv; if (asr == NULL) { - priv = _THREAD_PRIVATE(_asr, asr, &_asr); + priv = _THREAD_PRIVATE(_asr, _asr, &_asr); if (*priv == NULL) return; asr = *priv; @@ -346,7 +346,7 @@ asr_use_resolver(struct asr *asr) if (asr == NULL) { DPRINT("using thread-local resolver\n"); - priv = _THREAD_PRIVATE(_asr, asr, &_asr); + priv = _THREAD_PRIVATE(_asr, _asr, &_asr); if (*priv == NULL) { DPRINT("setting up thread-local resolver\n"); *priv = async_resolver(NULL); -- cgit v1.2.3