Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA] Fix a memory leak in py-param.c
Date: Thu, 21 Jun 2018 01:39:00 -0000	[thread overview]
Message-ID: <82b158062718433683eca9daef46a66d@polymtl.ca> (raw)
In-Reply-To: <20180620213836.3980-1-tom@tromey.com>

On 2018-06-20 17:38, Tom Tromey wrote:
> Mark Wielaard pointed out this memory leak to me:
> 
>     ==17633== 775 bytes in 1 blocks are definitely lost in loss record
> 13,346 of 13,967
>     ==17633==    at 0x4C2DB6B: malloc (vg_replace_malloc.c:299)
>     ==17633==    by 0x6652B7: xmalloc (common-utils.c:45)
>     ==17633==    by 0xC4C889: xstrdup (xstrdup.c:34)
>     ==17633==    by 0x5A71FD: unicode_to_encoded_string(_object*, char
> const*) (py-utils.c:81)
>     ==17633==    by 0x5A73EB: python_string_to_host_string(_object*)
> (py-utils.c:158)
>     ==17633==    by 0x59CC6C: get_doc_string(_object*, _object*)
> (py-param.c:334)
>     ==17633==    by 0x59D2AA: parmpy_init(_object*, _object*,
> _object*) (py-param.c:728)
> 
> The bug here is that parmpy_init is written as though
> add_setshow_generic takes ownership of its doc-string arguments.
> However, it does not.  This patch fixes the bug in a straightforward
> way and also applies some missing constification to make the problem
> more apparent.
> 
> Tested on x86-64 Fedora 26.

LGTM, thanks.

Simon


      reply	other threads:[~2018-06-21  1:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-20 21:38 Tom Tromey
2018-06-21  1:39 ` Simon Marchi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=82b158062718433683eca9daef46a66d@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox