From patchwork Wed Sep 5 14:57:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Reutner-Fischer X-Patchwork-Id: 966445 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-485242-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="iU6Uzpm+"; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="GfwX8Ox4"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4256T05yqGz9s5c for ; Thu, 6 Sep 2018 01:05:24 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; q=dns; s=default; b=mWk H+IIVI/wxN1X3aCheTiG5tK5EGDrWQt1T4EFPAqyuGWyau8oiuctLLvD8j3Vv6Xi jrdvvx3IzEsVjTO2yvIjiePgOE5OHPNxhKHVfqyG/2xysi1g80oauf6Lr08JF6sN 4oDw9FCclTzTOu7O7SNwt73dADPpciC2UCQvo+uk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=default; bh=8moits+wy WaXGwQAwO7wyHtZBiA=; b=iU6Uzpm+ayyftIt+c7M9rNhH8CgFcHHueRltbyouK OvhHliqDdwM75/1ewOcMaK7mH6SB0pfOj0f755RFqAFuZFVb8Vk0IDKuTKWdR+hm VjOP72gnokFp0EhOiW0NuSwg0l1suX0aENCtV6cXqiu835Wj7NyUuUaFKndNvQ/r 9g= Received: (qmail 101200 invoked by alias); 5 Sep 2018 15:02:43 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 101083 invoked by uid 89); 5 Sep 2018 15:02:42 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.8 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=4945 X-HELO: mail-wm0-f45.google.com Received: from mail-wm0-f45.google.com (HELO mail-wm0-f45.google.com) (74.125.82.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 05 Sep 2018 15:02:41 +0000 Received: by mail-wm0-f45.google.com with SMTP id o18-v6so8139221wmc.0; Wed, 05 Sep 2018 08:02:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5BrOu6aEd+Eui57atZN//8LFnSqYuh0+77Fj+dJfQbE=; b=GfwX8Ox4ZUaDWXcMM+LXayB8eIKFqq6TSTD3+quIwozSo0n7zd+3+6b2qtNBEW8ypo ooNzpVLZjmpL74hqSJVuzD0bMiJCVllf7n5osd4NL49/OWtRBmbNKWCCeUVqTqBjzS3t orpZLGwuJGK/RHWL41NuLPeQBonZ8l9ylVpzHRj1rJziCVrTG1btGKZfC5G7euXoproF PmBHpQ4bHDWbZnowfZF8BddD/qpVgm25KjvimCbARBIqeX2y+XQdLDCUHCtbrcjzN/NL S3Izv1HthBlTRi9omYxWl9D+Vosv3tcNCknRSgOZpJts5eYxMFCaUUspKcJpNYYmejge TY4Q== Received: from s46.loc (91-119-125-11.dsl.dynamic.surfer.at. [91.119.125.11]) by smtp.gmail.com with ESMTPSA id j2-v6sm3264281wmj.5.2018.09.05.08.02.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Sep 2018 08:02:38 -0700 (PDT) Received: from cow by s46.loc with local (Exim 4.91) (envelope-from ) id 1fxZFb-00008b-Uz; Wed, 05 Sep 2018 14:57:47 +0000 From: Bernhard Reutner-Fischer To: fortran@gcc.gnu.org Cc: Bernhard Reutner-Fischer , gcc-patches@gcc.gnu.org Subject: [PATCH,FORTRAN 28/29] Free type-bound procedure structs Date: Wed, 5 Sep 2018 14:57:31 +0000 Message-Id: <20180905145732.404-29-rep.dot.nop@gmail.com> In-Reply-To: References: MIME-Version: 1.0 X-IsSubscribed: yes From: Bernhard Reutner-Fischer compiling gfortran.dg/typebound_proc_31.f90 leaked the type-bound structs: 56 bytes in 1 blocks are definitely lost. at 0x4C2CC05: calloc (vg_replace_malloc.c:711) by 0x151EA90: xcalloc (xmalloc.c:162) by 0x8E3E4F: gfc_get_typebound_proc(gfc_typebound_proc*) (symbol.c:4945) by 0x84C095: match_procedure_in_type (decl.c:10486) by 0x84C095: gfc_match_procedure() (decl.c:6696) ... gcc/fortran/ChangeLog: 2017-12-06 Bernhard Reutner-Fischer * symbol.c (free_tb_tree): Free type-bound procedure struct. (gfc_get_typebound_proc): Use explicit memcpy for clarity. --- gcc/fortran/symbol.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c index 53c760a6c38..cde34c67482 100644 --- a/gcc/fortran/symbol.c +++ b/gcc/fortran/symbol.c @@ -3845,7 +3845,7 @@ free_tb_tree (gfc_symtree *t) /* TODO: Free type-bound procedure structs themselves; probably needs some sort of ref-counting mechanism. */ - + free (t->n.tb); free (t); } @@ -5052,7 +5052,7 @@ gfc_get_typebound_proc (gfc_typebound_proc *tb0) result = XCNEW (gfc_typebound_proc); if (tb0) - *result = *tb0; + memcpy (result, tb0, sizeof (gfc_typebound_proc));; result->error = 1; latest_undo_chgset->tbps.safe_push (result);