Message ID | 20191120115926.23272-8-ynezz@true.cz |
---|---|
State | Superseded |
Headers | show
Return-Path: <openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=<UNKNOWN>) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=true.cz Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="hDOD22Ld"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47J1WL0G4Xz9sPZ for <incoming@patchwork.ozlabs.org>; Wed, 20 Nov 2019 23:01:34 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:MIME-Version:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cBjYUiR1ZJIBxWvq7xY3uqadTeNpwmghvoVxYqhOGgw=; b=hDOD22LduDTh4X axMNpZpN/ijK022YTYeacurq2Bn7Ui/wtoxnpqvX3CEee7HbCNIon4UZY/Xw1S6DthSl9Bztlp9GT 8DAPADX9djcI06sAwT1PBBpHWbFWI8V8GOGOoot+jRgOIjHHwcMXKpb28JUy/TRv/ybjEE8MloiOD cg3rLUF+rt/NkcbHrPjIkmzaVwrWVG4EgFuSLFFf0NwpE+0AaRflkBxcfXJCAas0loMHxStThS9oI DDcgU+s/mHqXuZRcpT9XwhYVmK82+dXHzsBc+X3rLr218qXsmWGAIN9zQI77iEZHMPatTyE/wdTeZ 5SW8jGooeYxjVQrH5jZQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iXOfq-00054E-6X; Wed, 20 Nov 2019 12:01:30 +0000 Received: from smtp-out.xnet.cz ([178.217.244.18]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iXOe6-0001a1-Ez for openwrt-devel@lists.openwrt.org; Wed, 20 Nov 2019 11:59:44 +0000 Received: from meh.true.cz (meh.true.cz [108.61.167.218]) (Authenticated sender: petr@true.cz) by smtp-out.xnet.cz (Postfix) with ESMTPSA id C526E4671; Wed, 20 Nov 2019 12:59:32 +0100 (CET) Received: by meh.true.cz (OpenSMTPD) with ESMTP id e15fef76; Wed, 20 Nov 2019 12:59:22 +0100 (CET) From: =?utf-8?q?Petr_=C5=A0tetiar?= <ynezz@true.cz> To: openwrt-devel@lists.openwrt.org Date: Wed, 20 Nov 2019 12:59:24 +0100 Message-Id: <20191120115926.23272-8-ynezz@true.cz> In-Reply-To: <20191120115926.23272-1-ynezz@true.cz> References: <20191120115926.23272-1-ynezz@true.cz> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191120_035942_705400_1C27CD9D X-CRM114-Status: UNSURE ( 7.70 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [178.217.244.18 listed in list.dnswl.org] 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record Subject: [OpenWrt-Devel] [PATCH libubox 7/9] jshn: jshn_parse: fix leaks of memory pointed to by 'obj' X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: <openwrt-devel.lists.openwrt.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/openwrt-devel>, <mailto:openwrt-devel-request@lists.openwrt.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/openwrt-devel/> List-Post: <mailto:openwrt-devel@lists.openwrt.org> List-Help: <mailto:openwrt-devel-request@lists.openwrt.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/openwrt-devel>, <mailto:openwrt-devel-request@lists.openwrt.org?subject=subscribe> Cc: =?utf-8?q?Petr_=C5=A0tetiar?= <ynezz@true.cz> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: "openwrt-devel" <openwrt-devel-bounces@lists.openwrt.org> Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org |
Series |
fixes, some unit tests and GitLab CI
|
expand
|
diff --git a/jshn.c b/jshn.c index 02b35286ea8b..5298d52e729a 100644 --- a/jshn.c +++ b/jshn.c @@ -178,12 +178,15 @@ static int jshn_parse(const char *str) obj = json_tokener_parse(str); if (!obj || json_object_get_type(obj) != json_type_object) { + if (obj) + json_object_put(obj); fprintf(stderr, "Failed to parse message data\n"); return 1; } fprintf(stdout, "json_init;\n"); add_json_object(obj); fflush(stdout); + json_object_put(obj); return 0; }
Fixes following leaks of memory: 352 (72 direct, 280 indirect) bytes in 1 blocks are definitely lost in loss record 3 of 3 at 0x4C31B25: calloc by 0x5042E1F: json_object_new_array by 0x5044B02: json_tokener_parse_ex by 0x5045316: json_tokener_parse_verbose by 0x504537D: json_tokener_parse by 0x401AA9: jshn_parse (jshn.c:179) by 0x401977: main (jshn.c:378) 752 (72 direct, 680 indirect) bytes in 1 blocks are definitely lost in loss record 6 of 6 at 0x4C31B25: calloc by 0x50424CF: json_object_new_object by 0x5044B38: json_tokener_parse_ex by 0x5045316: json_tokener_parse_verbose by 0x504537D: json_tokener_parse by 0x401AA9: jshn_parse (jshn.c:179) by 0x401977: main (jshn.c:380) Signed-off-by: Petr Štetiar <ynezz@true.cz> --- jshn.c | 3 +++ 1 file changed, 3 insertions(+)