diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2013-04-11 20:19:17 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2013-04-11 20:19:17 +0000 |
commit | c6f87be04ebaa54a85855700298946afc979cb72 (patch) | |
tree | 6d93834090e7d613480be8a91527cb27c18f526d | |
parent | 4887f83f554a1d52cdd292f9e4c1ccee5db83c51 (diff) |
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@
-rw-r--r-- | lib/libc/asr/asr.c | 6 |
1 files 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 <eric@openbsd.org> * @@ -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); |