From patchwork Sun Apr 2 15:05:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Reutner-Fischer X-Patchwork-Id: 78256 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1785275vqo; Sun, 2 Apr 2023 08:07:22 -0700 (PDT) X-Google-Smtp-Source: AKy350YR3LHc3ZsN0Gyoqs8lX8ojZ35RtGuQsXA5VW6PU75/j37Ko5QuWtJ3A2TUO/HxfCyYOHwf X-Received: by 2002:a17:906:daca:b0:947:f246:b9d8 with SMTP id xi10-20020a170906daca00b00947f246b9d8mr6556289ejb.45.1680448042601; Sun, 02 Apr 2023 08:07:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680448042; cv=none; d=google.com; s=arc-20160816; b=Vv2fMWv+8m+/v+EkH0WOJwvjWaiTEB0RyknChcSqyNd7PXZQEIcVPeFJEA4j6cmHK3 5Ek72AqkfuDzpw2dakN/tni/ay4O/Ed0CzP+RI2/G9Z68S7mgA9ZoxppTVuXjuj114Bn GOseuGEqxVATpE6jefE6y4VjO4lcCBERsuRoD2hinnndezp264sVW6CVgZSgey0AobBl SzD/rRsxLUppfL40zPoOVZMi7haXUvSaKcr0q5FBUhAAWn+Ds35jtiUpK1EZg0AYZpga upZOWTP3YABeIPlnMzNQKLlHV2CSnhmfPK5RqYrKxqBszzm7pD1uB3ufp+Q0pb9RhCrV f24w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=dUnZb84GUq/oUGD2VePbz9JabCxAwoAfVHWOISUsrnM=; b=GlRYQ/EJsOraajLtUdKCKD8EEFX1yOB3xpv9vcMs9Ivkc9Fit7KkZuOD9azXrA4Rwq Pua6uawc5p4/OHdz7siez5ExRBzLtKToJP7vSHDpQwzQp0ica11ZbI8W3o/Glu/VDkPE ZuMLHmZqEgbJ9X/h86APwiqWp4Cr9DV1NnD3dut3+2cqTsbJaQs6Nz53Qs5pcMhx8hlH /s1q4R+HI7phBt1nK2OxWWKCRTXN6p6ePe+VymLfaf4ZCtqgMdGM5nUQutx3qIsqcBSl yFZRU+HF6LYaoU4rmsayKj/XVnSA7P3kzIXQQu7HYB3FgveYSGIGRgp388rLsvQnX7UR cupA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="UQW/QZtf"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id b23-20020a17090636d700b008cd6f50c059si2428329ejc.669.2023.04.02.08.07.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Apr 2023 08:07:22 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="UQW/QZtf"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C1EC63858C36 for ; Sun, 2 Apr 2023 15:06:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C1EC63858C36 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1680447999; bh=dUnZb84GUq/oUGD2VePbz9JabCxAwoAfVHWOISUsrnM=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=UQW/QZtfOded/fPzkyT2idnYxT+YewPk+21cIhOPC5lKONOKDHfZHOB4eIPOgGwkX 9j1V6inXWOIeLhqf3F2Jk5XoorVU1j4EYF/y494Bm9P97FQ7indABfBA/YIc6zUob3 EY4fGZwFu4WsP5SCq/62Hvk0/SlyVOx9lboA3m0k= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by sourceware.org (Postfix) with ESMTPS id 626813858C53; Sun, 2 Apr 2023 15:05:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 626813858C53 Received: by mail-ed1-x52b.google.com with SMTP id eg48so107761924edb.13; Sun, 02 Apr 2023 08:05:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680447940; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dUnZb84GUq/oUGD2VePbz9JabCxAwoAfVHWOISUsrnM=; b=DIigW6EAQr5MtrvglT+OpYJQRRowSmGo69H2tc+9lEyaV4d4mlVO6IWqaHZSxdv/Eb utoI+JjhjA6YVpXCJEEsbqhHf6ZzlyBT9OqSZaskYJ5XqbeA7mOrSN2EqZqrtXQJjo/M sWaXeYDnGFK+NnRpZ7J/A4g5Opm8hoOnW2gK+lFu42WyTL+7aMHeZ4V67jYyBhsRlL+K psGXV4rxDNL7/qBem1pbniBsC7afJWCVF78OPBAmg0H6L5I8O5VgzaKyilYfdWtaw4rG w2YOZK53FemNsc+HffOecOa60j3QHF4/2x16DEqHUMI+zuNtzfhRHfyZHaNsGhQfB62k xkbg== X-Gm-Message-State: AAQBX9fbjh4aLNfYuY+ZPtyLz2Tm01zSouZd6XHvnTgAkBIre6TMad2q 7K67Z9+BX80tpkyBOSspR856jL6b5rM= X-Received: by 2002:aa7:d313:0:b0:4f9:e6f1:5c7c with SMTP id p19-20020aa7d313000000b004f9e6f15c7cmr33610491edq.32.1680447940742; Sun, 02 Apr 2023 08:05:40 -0700 (PDT) Received: from nbbrfq ([2001:871:227:1e16:8ec:e883:b72a:18fd]) by smtp.gmail.com with ESMTPSA id m9-20020a50c189000000b004fd2aab4953sm3360051edf.45.2023.04.02.08.05.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Apr 2023 08:05:38 -0700 (PDT) Received: from b by nbbrfq with local (Exim 4.96) (envelope-from ) id 1pizGz-000Ad0-1Q; Sun, 02 Apr 2023 17:05:37 +0200 To: gcc-patches@gcc.gnu.org Cc: Bernhard Reutner-Fischer , Ian Lance Taylor Subject: [PATCH 1/3] go: Fix memory leak in Integer_expression Date: Sun, 2 Apr 2023 17:05:13 +0200 Message-Id: <20230402150515.40826-2-rep.dot.nop@gmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-10.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Bernhard Reutner-Fischer via Gcc-patches From: Bernhard Reutner-Fischer Reply-To: Bernhard Reutner-Fischer Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762077486708725440?= X-GMAIL-MSGID: =?utf-8?q?1762077486708725440?= From: Bernhard Reutner-Fischer Cc: Ian Lance Taylor gcc/go/ChangeLog: * gofrontend/expressions.cc (Integer_expression::do_import): Fix memory leak. --- gcc/go/gofrontend/expressions.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index 4ac55af7433..93f5d5dc52b 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -2728,6 +2728,7 @@ Integer_expression::do_import(Import_expression* imp, Location loc) { go_error_at(imp->location(), "bad number in import data: %qs", real_str.c_str()); + mpfr_clear (real); return Expression::make_error(loc); } } @@ -2743,6 +2744,8 @@ Integer_expression::do_import(Import_expression* imp, Location loc) { go_error_at(imp->location(), "bad number in import data: %qs", imag_str.c_str()); + mpfr_clear (imag); + mpfr_clear (real); return Expression::make_error(loc); } mpc_t cval; @@ -2766,6 +2769,7 @@ Integer_expression::do_import(Import_expression* imp, Location loc) { go_error_at(imp->location(), "bad number in import data: %qs", num.c_str()); + mpz_clear (val); return Expression::make_error(loc); } Expression* ret; @@ -2783,6 +2787,7 @@ Integer_expression::do_import(Import_expression* imp, Location loc) { go_error_at(imp->location(), "bad number in import data: %qs", num.c_str()); + mpfr_clear (val); return Expression::make_error(loc); } Expression* ret = Expression::make_float(&val, NULL, loc);