Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2195405rwb; Wed, 30 Nov 2022 03:46:30 -0800 (PST) X-Google-Smtp-Source: AA0mqf6SrvdCjfs5ON7oDaCgCtxaR3lrhkHjuSq5MfKK0VHbU9twGzi501xza9dev+HWKAp3g6gV X-Received: by 2002:a17:907:874f:b0:7b5:e91:adf9 with SMTP id qo15-20020a170907874f00b007b50e91adf9mr25400020ejc.277.1669808790538; Wed, 30 Nov 2022 03:46:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669808790; cv=none; d=google.com; s=arc-20160816; b=u37svkPQRWTVCbIahPyP9bpdTB55mBgMQo3xBeUaI/+AmF152Bd0P/RQrSEj5nWdjK Vcknbne6G3TZlxpPcKVSiaBDaqQ7xHEzcyNUGliPNCn+WSrjuF2F4SbVkbzBn9m33Cij fGTfJixJLerzfB244CIGiothpC3H58lhL7CqPa1w7vOshRmPnYrX6/yBGDIPypaAKQdD +9MLaBpBio0GeRmaY5xqmrk6EdvrI3raYJnIvwMM58rTfDepwu42/WmjxB+EOhm7yn+o 26rAgpzcqUwshs6FNL0FbpxwTtnL+1Mxz7/pEJpmgDVX6RAd6C8CTT4V1Vmx5tm7822y 2aQA== 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=yqszlyxLYRjp13UAyGqhyd69FwClAv6auwVEI710LrE=; b=g1DweZIsa5PUZlZt0PUg4ebXQ0PSYannZ5pq5awxXYtWq95TdopqE2SpKGnIpI0TRz k5GhmqFxe6vaquBBsQHQi7Y9oCKckLz8qAvclERMCsomlXGZpxxgP2QbhYM+xAJRHMU9 RNzcL4iBHchNsK5Qwxj231dFC4i6lO9OWv4E2jI5WY7IKqgVrl2mmQsJPDc0eVVN2iDP TPz53Wq/ZCV+zr1YAt1q+5ur7FvTFxeoBCqWh9Mp8QxsIV1/qmvx04GYuP11LUMDaU21 4UIQ6Z0NofinZpMPsQ80tMnHbKBcdkoyBhrQKf7cgYvoDQO/xbB/PHodQTh3aeHArLRE 2/Aw== 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 qw2-20020a1709066a0200b007ae4c686a4esi1176321ejc.159.2022.11.30.03.46.10; Wed, 30 Nov 2022 03:46:30 -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 S232227AbiK3Kpy (ORCPT + 84 others); Wed, 30 Nov 2022 05:45:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232071AbiK3Kpw (ORCPT ); Wed, 30 Nov 2022 05:45:52 -0500 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 477E25F865 for ; Wed, 30 Nov 2022 02:45:51 -0800 (PST) Received: from fraeml712-chm.china.huawei.com (unknown [172.18.147.200]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4NMbT10wGfz67TN2; Wed, 30 Nov 2022 18:45:25 +0800 (CST) Received: from lhrpeml500004.china.huawei.com (7.191.163.9) by fraeml712-chm.china.huawei.com (10.206.15.61) 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 11:45:48 +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 10:45:47 +0000 From: Konstantin Meskhidze To: CC: , , , , , , , , Subject: [PATCH] objtool: Fix memory leakage Date: Wed, 30 Nov 2022 18:45:44 +0800 Message-ID: <20221130104544.2789085-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: mscpeml100002.china.huawei.com (7.188.26.75) 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 potential memory leakage in elf_create_section_symbol() function. Signed-off-by: Konstantin Meskhidze --- tools/objtool/elf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c index 7e24b09b1163..58f30840358f 100644 --- a/tools/objtool/elf.c +++ b/tools/objtool/elf.c @@ -776,6 +776,7 @@ elf_create_section_symbol(struct elf *elf, struct section *sec) if (elf_update_symbol(elf, symtab, symtab_shndx, old)) { WARN("elf_update_symbol move"); + free(sym); return NULL; } @@ -785,6 +786,7 @@ elf_create_section_symbol(struct elf *elf, struct section *sec) sym->idx = new_idx; if (elf_update_symbol(elf, symtab, symtab_shndx, sym)) { WARN("elf_update_symbol"); + free(sym); return NULL; } -- 2.25.1