From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21479 invoked by alias); 28 Jun 2016 10:43:00 -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 21465 invoked by uid 89); 28 Jun 2016 10:42:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=sk:gdbarch, 18108 X-HELO: mail-oi0-f49.google.com Received: from mail-oi0-f49.google.com (HELO mail-oi0-f49.google.com) (209.85.218.49) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 28 Jun 2016 10:42:48 +0000 Received: by mail-oi0-f49.google.com with SMTP id u201so16757817oie.0 for ; Tue, 28 Jun 2016 03:42:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=uzqHiXKds4k7CkK2hlDM2+2UZ9wcMHyNQlnhCQjo7tw=; b=eTNSMIP5mzQVdTowt5S5Vk5OHEUMZWHnKriROblOJtrhE/k8Q6ZzxXYFLSOCp8XDeo rpwGlOv/nv+N2+BY8YEoUCot/SKd60NkN3pwzdY3UAISV247ck+EjR30mg66Rr9St0US z8pNV8pFBTqxTlIksJ7Pv8rpKsVtsBXHm1pX2u90CN1cISXaOWHIJLMoIAaNK0vx8bX8 0Z06iz5uYEd4iuRO6k/UZf9KIxpMem5B07AIfGAZ9JYhWElYCvLXLNLuh2hjEkYSJPCR brzz3UoWJBkKKSu+uaMzoUEB8V+Qr+CVPDzZ+2yHpmQHryfKiF4jecbj/vVljKzVM+JO ChSA== X-Gm-Message-State: ALyK8tJNlBXI9CpMlvjtJNK1+iAjgLE0/RNx1vU+br3xd4HMhaeNK7f68kMDdzVT/xe909R5Va53tlkwhLbWFA== X-Received: by 10.157.5.194 with SMTP id 60mr1230621otd.161.1467110566968; Tue, 28 Jun 2016 03:42:46 -0700 (PDT) MIME-Version: 1.0 Received: by 10.202.182.130 with HTTP; Tue, 28 Jun 2016 03:42:46 -0700 (PDT) In-Reply-To: <1465490013-15336-1-git-send-email-tom@tromey.com> References: <1465490013-15336-1-git-send-email-tom@tromey.com> From: Yao Qi Date: Tue, 28 Jun 2016 10:43:00 -0000 Message-ID: Subject: Re: [RFA] PR gdb/17210 - fix possible memory leak in read_memory_robust To: Tom Tromey Cc: "gdb-patches@sourceware.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2016-06/txt/msg00458.txt.bz2 On Thu, Jun 9, 2016 at 5:33 PM, Tom Tromey wrote: > > VEC(memory_read_result_s) * > @@ -1810,6 +1810,8 @@ read_memory_robust (struct target_ops *ops, > { > VEC(memory_read_result_s) *result =3D 0; > int unit_size =3D gdbarch_addressable_memory_unit_size (target_gdbarch= ()); > + struct cleanup *cleanup =3D make_cleanup (free_memory_read_result_vect= or, > + &result); > result is a local variable on stack, so its address is meaningless when the exception is throw, because the stack has already been destroyed. Probably, we can register cleanup for result once it becomes to non-NULL, and changes in free_memory_read_result_vector are not needed. --=20 Yao (=E9=BD=90=E5=B0=A7)