Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 Jul 2019 07:53:45 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 239520] Possible memory leak in newlocale/uselocale
Message-ID:  <bug-239520-227-lhWvVoBMVZ@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-239520-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-239520-227@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D239520

--- Comment #2 from Baggio Kwok <rootkwok@cpan.org> ---
1. atomic_fetchadd_long returns previous value, so I think
/usr/src/lib/libc/locale/xlocale_private.h:184 should check for count =3D=
=3D 0?

2. looks like atomic_fetchadd_long is expecting u_long which is unsigned, w=
ould
passing -1 in /usr/src/lib/libc/locale/xlocale_private.h:183 works as we
expected?

__________________________________________________
sys/amd64/include/atomic.h

241 /*
242  * Atomically add the value of v to the long integer pointed to by p and
return
243  * the previous value of *p.
244  */
245 static __inline u_long
246 atomic_fetchadd_long(volatile u_long *p, u_long v)
247 {
248=20
249   __asm __volatile(
250   " " MPLOCKED "    "
251   " xaddq %0,%1 ;   "
252   "# atomic_fetchadd_long"
253   : "+r" (v),     /* 0 */
254     "+m" (*p)     /* 1 */
255   : : "cc");
256   return (v);
257 }

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-239520-227-lhWvVoBMVZ>