]> git.ipfire.org Git - thirdparty/json-c.git/commit
Fix memory leak on macOS by auto-enabling NEWLOCALE_NEEDS_FREELOCALE 915/head
authorJaisonZheng <1254186821@qq.com>
Wed, 21 Jan 2026 09:28:20 +0000 (17:28 +0800)
committerJaisonZheng <1254186821@qq.com>
Wed, 21 Jan 2026 09:28:20 +0000 (17:28 +0800)
commit653a12c7c2f765f397fe74d34995262bd7fa92e0
tree8e1a77ec7a0b52bc01dd909a533d2554b47ba0d7
parentd05ea4851f93867f2891f8eed2ca0fcd7b75e53d
Fix memory leak on macOS by auto-enabling NEWLOCALE_NEEDS_FREELOCALE

macOS's newlocale() does not follow POSIX specification - it doesn't
reuse the passed locale_t, causing ~1,472 bytes leak per json_tokener_parse() call.

This is the same issue as #668 (FreeBSD). The existing workaround works,
but macOS was not auto-detected.

Tested with AddressSanitizer: leak drops from 1,472,000 bytes to ~120 bytes
(system init only).
CMakeLists.txt