From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 82ED9606A320 for ; Mon, 30 Nov 2026 10:02:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=buildroot.org header.i=@buildroot.org header.a=rsa-sha256 header.s=default header.b=gsuX6+DN Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 5F63F606D3; Mon, 30 Nov 2026 10:02:11 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id G7kmBdFjVCjk; Mon, 30 Nov 2026 10:02:10 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp3.osuosl.org 37BF6606A2 Authentication-Results: smtp3.osuosl.org; arc=none smtp.remote-ip=140.211.166.142 ARC-Seal: i=1; d=osuosl.org; s=arc; a=rsa-sha256; cv=none; t=1796032930; b=j+Axa8Oxegz5Lv3eQgUtn5dj0LD3uPvaZSXFj5NRQAhbXC8lOafzrpr+LQ9Vmuo/7van knBiH1+OseoVEaS8iDz1f40z5TCKgZyrRmEIlChddigaYjzY0VdoOhMmBWKUSrme/MwF8 emQfincHNtj+5MzMvsKR/wKFYUryu2KJ13m+oFL/OSjXAcY/fx14+2xlf7wipSHWH85Rn IKl/d3ACspFCjstsfcE4TKt8z5stxeBqP0YaAIJBwp8GYw+EMmOkZvoljGTy+iTftuRiG /ibStm/hsMwP/U9vExXEPFH9REAKaBhAtdQVRMFA8Io0qZ6q8GCMeLr4GQNcuBbcH5Q== ARC-Message-Signature: i=1; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1796032930; h=X-Comment:DKIM-Signature:X-Original-To:Delivered-To:Received: Received:X-Virus-Scanned:X-Spam-Flag:X-Spam-Score:X-Spam-Level: X-Spam-Status:Received:ARC-Filter:Received-SPF:Received:Received: Received:Received:To:CC:Date:Message-ID:X-Mailer:MIME-Version: X-C2ProcessedOrg:X-CrossPremisesHeadersFilteredBySendConnector: X-OrganizationHeadersPreserved:X-Df-Sender:Subject:X-BeenThere: X-Mailman-Version:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:Content-Type: Content-Transfer-Encoding:Errors-To:Sender; bh=HTQetB1vuP8BjRhaG5BaneHOaPXTL+iTstpzwSMWk6k=; b=h2RjM5tUjXg6hqDwBoKJmAODcRVnorWmjTFSm4rbv6PjzIA2ywSUz8ASQi4Dz9CeRWBz PjTILpLZEniF4gc2jCRZnLtlr2cjRp7CM9jY4uqVjKxmsCx/QygKWZYcq6qvLTNUgwcd0 Ygk5/C7bqf+y2KaKTPrS0Lbn1S+noBu07C+4AF4kz0K6HmxNQ6JKxDgY9XheZttgt3wzu 2aFZ23huZCWJTZPTm0/FctAPwkcW/ymzCNOG238DUc7/Gta5c95XXSg+2jLnus0zaw6Os KfoK3XqNhF7TIeoDlzw/jfQH05uGx5fMqU0fpdanf+sbVqbBqt/cMPpHOxvFeZyu5XQ== ARC-Authentication-Results: i=1; smtp3.osuosl.org; arc=none smtp.remote-ip=140.211.166.142 X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=buildroot.org; s=default; t=1796032930; bh=HTQetB1vuP8BjRhaG5BaneHOaPXTL+iTstpzwSMWk6k=; h=To:CC:Date:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=gsuX6+DNy8MKqtqn9MqHHzl9Mef4GluKxYYXi5QGNYF4h+dFRBk6uizD1PY6Hq2DM yLOqTg7KafLo5X4jv4xp/RqNx1EhUq6EYWI3sRYn/B0vcP6oPROgkN/H8HIifLQTSW vV9JTxNSdEsLDEDvBvbQyp7I+Bxb9akU8rXyTmqkd/1tglJ4sBtZslvEK3qvyvAV/t +loNMs6KWIUPoy4RiZbZXsBk+yUcMngMohgiFt4E1+SjXOBxpF59D65M1uHxABeL+S Ozi1c8WG9xAOqYvEpq9aitnS+iQs3wHRrgZoogVtMWCB5drJOue5wksVSKp6vimltV IOaN0CdtwnTLQ== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp3.osuosl.org (Postfix) with ESMTP id 37BF6606A2; Mon, 30 Nov 2026 10:02:10 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists1.osuosl.org (Postfix) with ESMTP id AC600373 for ; Mon, 30 Nov 2026 10:02:08 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 926C080BC4 for ; Mon, 30 Nov 2026 10:02:08 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id Dz3foZv-tjsU for ; Mon, 30 Nov 2026 10:02:08 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp1.osuosl.org 9375C80B9D Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=80.67.31.103; helo=smtprelay06.ispgateway.de; envelope-from=mf@go-sys.de; receiver= Received: from smtprelay06.ispgateway.de (smtprelay06.ispgateway.de [80.67.31.103]) by smtp1.osuosl.org (Postfix) with ESMTPS id 9375C80B9D for ; Mon, 30 Nov 2026 10:02:06 +0000 (UTC) Received: from [80.128.11.17] (helo=mail.go-sys.de) by smtprelay06.ispgateway.de with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.99.1) (envelope-from ) id 1xXyCx-000000006hG-3i9i for buildroot@buildroot.org; Mon, 30 Nov 2026 11:02:03 +0100 Received: from mail.go-sys.de (192.168.1.9) by mail.go-sys.de (192.168.1.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.61; Mon, 30 Nov 2026 11:02:03 +0100 Received: from go-sys.de (192.168.1.131) by mail.go-sys.de (192.168.1.9) with Microsoft SMTP Server id 15.1.2507.61 via Frontend Transport; Mon, 30 Nov 2026 11:02:03 +0100 To: CC: Michael Fischer Date: Mon, 30 Nov 2026 11:01:59 +0100 Message-ID: <20261130100159.29006-1-mf@go-sys.de> X-Mailer: git-send-email 2.53.0 X-Archived-By: MIME-Version: 1.0 X-C2ProcessedOrg: 5fa85167-cd6f-46be-bafe-19070fe3dac3 X-CrossPremisesHeadersFilteredBySendConnector: mail.go-sys.de X-OrganizationHeadersPreserved: mail.go-sys.de X-Df-Sender: c21hcnRob3N0QGdvLXN5cy5kZQ== Subject: [Buildroot] [PATCH] package/json-c: fix memory leak X-BeenThere: buildroot@buildroot.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Discussion and development of buildroot List-Archive: List-Post: List-Help: List-Subscribe: , From: Michael Fischer via buildroot Reply-To: Michael Fischer Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "buildroot" X-Spam-Status: No, score=-19.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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 (measured on a BlueBox: ~0.5 kB per JSON object, the web interface alone filled the heap until the memory watchdog restarted the device). Evaluate the call unconditionally and only assert on its result. add patch: 0001-json_object_put-do-not-free-inside-assert.patch Signed-off-by: Michael Fischer --- ...object_put-do-not-free-inside-assert.patch | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 package/json-c/0001-json_object_put-do-not-free-inside-assert.patch diff --git a/package/json-c/0001-json_object_put-do-not-free-inside-assert.patch b/package/json-c/0001-json_object_put-do-not-free-inside-assert.patch new file mode 100644 index 0000000000..807d4cf589 --- /dev/null +++ b/package/json-c/0001-json_object_put-do-not-free-inside-assert.patch @@ -0,0 +1,37 @@ +From: Michael Fischer +Date: Wed, 11 Nov 2026 15:00:00 +0100 +Subject: [PATCH] json_object_put: do not free containers inside assert() + +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 +(measured on a BlueBox: ~0.5 kB per JSON object, the web interface alone +filled the heap until the memory watchdog restarted the device). + +Evaluate the call unconditionally and only assert on its result. + +Signed-off-by: Michael Fischer +--- + json_object.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/json_object.c b/json_object.c +--- a/json_object.c ++++ b/json_object.c +@@ -439,7 +439,11 @@ int json_object_put(struct json_object *jso) + // so we need to actually free it now + assert(jso->_ref_count == 0); + jso->_ref_count++; // We're the exclusive owner of jso, non-atomic add is ok. +- assert(_json_object_put_maybe_free(jso, 1) == 0); ++ { ++ int freed = _json_object_put_maybe_free(jso, 1); ++ assert(freed == 0); ++ (void)freed; ++ } + jso = parent; + // iteration will be reset at the top of the loop + } -- 2.53.0 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot