Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1789673rwb; Tue, 29 Nov 2022 19:56:34 -0800 (PST) X-Google-Smtp-Source: AA0mqf7eeiu621cNeS/uBHGMuhaZhfw/xoNEHKJCDGP0SBfQ4TAYXQgIKCqrO64Yc/gRk6CarQg+ X-Received: by 2002:a17:906:90c9:b0:7b2:b783:f26b with SMTP id v9-20020a17090690c900b007b2b783f26bmr47179742ejw.406.1669780594514; Tue, 29 Nov 2022 19:56:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669780594; cv=none; d=google.com; s=arc-20160816; b=Tou+I6CbHEACrQdE6yfcvmG6VCK2ZS1dmdgoOZqCBxIj3B9+YJ8x5/h7KN17ofcX/J cm4M7sW/uUi/nGuQvU8Dhvyt7qCjpCF3PzJ/BJC44WTEvrAhsYouFPNaNx5qepbO0Oqg 57MMSR95MOvB90TIC5o0IBaIlsd+sEYU3eDmyC25K72X+/BzS80zRmHkRaDQTHKZVYFZ ZlDgBCMnl1cJbKF91z5phpjfynMlEkKLjxvdYcI4q7u+arfb8XjgNZiy7/cpLVVJX8dp fFhh1eseISu8fKZLCmcLMEPi5PRNbQPOT4tC55604GvmH1ErAYjsbW6+nfPWZTO1i5L0 bo2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=I/P8dJPDcG+CfeiB9gM8X1uozIc21x5EqPkAW1ttHD4=; b=NfdiCKTwuDZBqU37ZyLIJ30n4fiHbAkxLt0seahReEKXvwfORD73kjuS9xsF/2Ragl BwqFIj/eRaCULhbEYkalkL7gRPJQXpbzdBdrcwtwJKK+lTmv3JsZQ43/q9B9i7ICf0f2 zrVLQ1CBmVl1veUE86ZNQyPiuG/IwPbLmxozkuUwzCDpJx6nZZlwk5ZE3P6GOE9JsK8n uAlL/dDqJxbvWl/ot4SMrA/f9hg3WU8gvA/X2x4/Y/Xj6h83xLaBH68UoldoXsaVAGsj AcuTjPRzmrwr9DJbnxypeE+xkEijLTQp6/DiMaK5BqwjmEAhcGs6FXzjjcKMOkkYYZ/g SB0Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hp8-20020a1709073e0800b0078d027ceb41si366926ejc.857.2022.11.29.19.56.14; Tue, 29 Nov 2022 19:56:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232248AbiK3Cgp (ORCPT + 85 others); Tue, 29 Nov 2022 21:36:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230049AbiK3Cgo (ORCPT ); Tue, 29 Nov 2022 21:36:44 -0500 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AFB024BEA for ; Tue, 29 Nov 2022 18:36:42 -0800 (PST) Received: from fraeml743-chm.china.huawei.com (unknown [172.18.147.200]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4NMNcd5XrBz67Q9H; Wed, 30 Nov 2022 10:36:17 +0800 (CST) Received: from lhrpeml500004.china.huawei.com (7.191.163.9) by fraeml743-chm.china.huawei.com (10.206.15.224) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 30 Nov 2022 03:36:40 +0100 Received: from mscphis00759.huawei.com (10.123.66.134) by lhrpeml500004.china.huawei.com (7.191.163.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 30 Nov 2022 02:36:39 +0000 From: Konstantin Meskhidze To: CC: , , , , , , , , Subject: [PATCH] objtool: Fix memory leakage Date: Wed, 30 Nov 2022 10:36:35 +0800 Message-ID: <20221130023635.2665668-1-konstantin.meskhidze@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.123.66.134] X-ClientProxiedBy: mscpeml100001.china.huawei.com (7.188.26.227) To lhrpeml500004.china.huawei.com (7.191.163.9) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This commit fixes memory leakage in handle_group_alt() function. Signed-off-by: Konstantin Meskhidze --- tools/objtool/check.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 43ec14c29a60..2689098e9bad 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -1569,6 +1569,7 @@ static int handle_group_alt(struct objtool_file *file, sizeof(struct cfi_state *)); if (!orig_alt_group->cfi) { WARN("calloc failed"); + free(orig_alt_group); return -1; } @@ -1603,6 +1604,7 @@ static int handle_group_alt(struct objtool_file *file, nop = malloc(sizeof(*nop)); if (!nop) { WARN("malloc failed"); + free(new_alt_group); return -1; } memset(nop, 0, sizeof(*nop)); -- 2.25.1