From: Yegor Yefremov <yegorslists@googlemail.com>
To: Michael Fischer <mf@go-sys.de>
Cc: buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH] package/json-c: fix memory leak
Date: Mon, 30 Nov 2026 15:02:52 +0100 [thread overview]
Message-ID: <20261130140252.375531-1-yegorslists@googlemail.com> (raw)
In-Reply-To: <20261130100159.29006-1-mf@go-sys.de>
Hi Michael,
On Mon, Nov 30, 2026 at 11:02 AM Michael Fischer <mf@go-sys.de> wrote:
>
> json-c 0.19 rewrote json_object_put() iteratively (issue #923). The final
> release of every non-empty object/array happens inside an assert():
>
> assert(_json_object_put_maybe_free(jso, 1) == 0);
>
> Buildroot builds json-c as CMAKE_BUILD_TYPE=Release, i.e. with -DNDEBUG, so
> the expression is never evaluated and every non-empty container leaks
(Review done with Claude's help, checked by me.)
Good catch, the analysis is right: Buildroot's CMake toolchain file sets
CMAKE_C_FLAGS_RELEASE to -DNDEBUG, so the free is compiled out.
This has already been fixed upstream, three days after the 0.19 release,
by commit f291fa81c6f2 ("free objects outside assert() in
json_object_put", PR #936), which does the same as your patch and applies
cleanly to 0.19. Could you send a v2 that backports it instead?
- Use the upstream commit as is
(https://github.com/json-c/json-c/commit/f291fa81c6f21d925ea771a8cca597f5886309cc.patch)
and add above your Signed-off-by:
Upstream: https://github.com/json-c/json-c/commit/f291fa81c6f21d925ea771a8cca597f5886309cc
check-package currently complains about the missing Upstream: tag.
- In the commit message, please add the culprit commit:
Fixes: b4b0e7b369761a4cea9809f73c836afc8adc3432 ("package/json-c: bump to version 0.19")
and drop the "add patch: ..." line.
0.18 didn't have this code, and all maintenance branches are still on
0.18, so only 2026.11-rc is affected. It would be good to have this in
before 2026.11 is released.
Best regards,
Yegor
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
prev parent reply other threads:[~2026-11-30 14:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 10:01 [Buildroot] [PATCH] package/json-c: fix memory leak Michael Fischer via buildroot
2026-11-30 14:02 ` Yegor Yefremov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261130140252.375531-1-yegorslists@googlemail.com \
--to=yegorslists@googlemail.com \
--cc=buildroot@buildroot.org \
--cc=mf@go-sys.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox