[Bug 239520] Possible memory leak in newlocale/uselocale

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Wed Jul 31 07:53:46 UTC 2019


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=239520

--- Comment #2 from Baggio Kwok <rootkwok at 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 == 0?

2. looks like atomic_fetchadd_long is expecting u_long which is unsigned, would
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 
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 }

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


More information about the freebsd-bugs mailing list