From: Tom Tromey <tom@tromey.com>
To: Simon Marchi <simon.marchi@polymtl.ca>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] python: Fix memleak in do_start_initialization
Date: Sun, 26 Nov 2017 19:00:00 -0000 [thread overview]
Message-ID: <87y3msvp9r.fsf@tromey.com> (raw)
In-Reply-To: <20171126035308.12274-1-simon.marchi@polymtl.ca> (Simon Marchi's message of "Sat, 25 Nov 2017 22:53:08 -0500")
>>>>> "Simon" == Simon Marchi <simon.marchi@polymtl.ca> writes:
Simon> While playing with valgrind, I noticed that the progname variable in
Simon> do_start_initialization is not being freed (concat returns a malloc'ed
Simon> string). Use a unique_xmalloc_ptr to manage it.
I don't think this is quite correct.
On the Python 2 branch, the code does this:
Py_SetProgramName (progname);
The docs for Py_SetProgramName say:
The argument should point to a
zero-terminated character string in static storage whose contents
will not change for the duration of the program's execution.
I think a comment referring to the Python docs would be better.
And, freeing progname on the Python 3 branch is ok.
Maybe the Python 2 branch could pass "progname.release ()".
Tom
next prev parent reply other threads:[~2017-11-26 19:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-26 3:53 Simon Marchi
2017-11-26 19:00 ` Tom Tromey [this message]
2017-11-26 20:56 ` Simon Marchi
2017-11-26 21:55 ` Tom Tromey
2017-11-27 0:36 ` Simon Marchi
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=87y3msvp9r.fsf@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
--cc=simon.marchi@polymtl.ca \
/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