From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 92488 invoked by alias); 9 Aug 2017 13:24:56 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 91519 invoked by uid 89); 9 Aug 2017 13:24:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy= X-HELO: mail-it0-f65.google.com Received: from mail-it0-f65.google.com (HELO mail-it0-f65.google.com) (209.85.214.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 09 Aug 2017 13:24:43 +0000 Received: by mail-it0-f65.google.com with SMTP id m34so4628495iti.0 for ; Wed, 09 Aug 2017 06:24:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=GnWCHR5fyCCXDbyc8wWpEddt9UFo76N9tRIgOCIO5AY=; b=qqoSz5kKzTfkbJ8yBG8NSlAfgp0H4hcDy8PIZh5uieXV+QhrgAI/XJjOtXpg5HSAQ+ FnZRb0ifae6nFiWy/9alB8qzIZ1u+r5Q1St2jTOerGwrXfkTcgtxNnHbowMQbnMjjHSl EHOleU3aa45IGZ788MYlrzLU5Lj7nsxc10ZRmzv6+Ac9KMEqYBgQ6vBDEMGWSCBdspt4 rQPrO3hxnxV+w3iGzlqsoEzkE/euuU8fd24vuD+u8j62ZKmAl9ABOqCHwk+PoSHziAFT eWk7DEshSfrb8E3cmpiWsDJppKPl4wN7KjqbMHpqObRs/UcPrefDtUgH1qwA76E9hPzr nCHg== X-Gm-Message-State: AIVw113EzRVIYh3mbo8nkL0wSYby6AbHLfIcaDYjJ6gNXbhuSfbtQgNh aaLegqBZ5qTOaUMMAPQ= X-Received: by 10.36.51.6 with SMTP id k6mr6671398itk.77.1502285077422; Wed, 09 Aug 2017 06:24:37 -0700 (PDT) Received: from [128.174.163.204] ([128.174.163.204]) by smtp.gmail.com with ESMTPSA id l5sm1862952ioe.65.2017.08.09.06.24.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Aug 2017 06:24:35 -0700 (PDT) Subject: Re: [PATCH] Fix memory leak in cp-support.c (cp_canonicalize_string) To: Yao Qi Cc: gdb-patches@sourceware.org References: <20170807201821.25207-1-alexlindsay239@gmail.com> <86k22dyno6.fsf@gmail.com> From: Alex Lindsay Message-ID: <069c5b61-0a1f-7c2e-8f51-85cd031ea979@gmail.com> Date: Wed, 09 Aug 2017 13:24:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <86k22dyno6.fsf@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2017-08/txt/msg00178.txt.bz2 Thanks Yao! On 08/09/2017 06:40 AM, Yao Qi wrote: > Alex Lindsay writes: > >> Formerly, in cp_canonicalize_string in cp-support.c, the return value of >> cp_comp_to_string was never freed, creating a sizable memory leak detectable >> with valgrind. This patch fixes the leak. However, a longer term solution >> would be to change the return type of cp_comp_to_string to >> gdb::unique_xmalloc_ptr. > Hi Alex, > Thanks a lot for the investigation and the patch. I revise it a little > to use gdb::unique_xmalloc_ptr, and fix another leak somewhere else. > Patch below is pushed in. >