From: Alex Kuleshov <kuleshovmail@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: "git\@vger.kernel.org" <git@vger.kernel.org>,
Jeff King <peff@peff.net>,
Eric Sunshine <sunshine@sunshineco.com>
Subject: Re: [PATCH] exec_cmd: system_path memory leak fix
Date: Mon, 24 Nov 2014 14:12:47 +0600 [thread overview]
Message-ID: <87lhn1au67.fsf@gmail.com> (raw)
In-Reply-To: <CAPc5daWnJCGPTMA0Hyg8QEAmsnF17ZQ9njGq8xVaUAfuwCRQDA@mail.gmail.com>
Junio C Hamano <gitster@pobox.com> @ 2014-11-24 13:37 ALMT:
> [jc: added those who were mentioned but were missing back to Cc]
>
> On Sun, Nov 23, 2014 at 11:02 PM, Alex Kuleshov <kuleshovmail@gmail.com> wrote:
>>
>> Junio C Hamano:
>>
>>>Fixing these callers are done as separate patches, that can be
>>>applied either before or after this patch.
>>
>> How to do it better? Update this patch, fix all callers which broken and
>> concat this patches to one or make separate patches?
>
> As I said, I do not think the approach your v2 takes is better than the original
> approach to pass the ownership of the returned value to the caller. I'd say that
> a cleaned up v1 that makes sure it adds a necessary strdup() in the codepath
> where it returns an absolute pathname given as-is, with necessary changes to
> callers that do not currently free the received result to free it when they are
> done, and to callers that currently do strdup() of the received result not to do
> strdup(), in a single patch, would be the right thing to do.
>
> I think I already wrote the bulk of proposed commit message for you for such
> a change earlier ;-) The one that talks about changing the contract between the
> system_path() and its callers.
>
> Thanks.
OK, but i'm little confused now, long thread :)
So what's our next strategy?
I'll make system_path will return volatile value, so callers must free
it by itself, but we have two types of callers:
Callers which doesn't need to store system_path return value (like git
--man-path and etc.. in git.c), and which need to store it (as in attr.c).
We must to free system_path return value in first case, and does not
need to create copy of returned string with xstrdup.
Am i correct or i'm wrong with this?
Thank you.
--
Best regards.
0xAX
next prev parent reply other threads:[~2014-11-24 8:18 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-23 13:56 GIT: [PATCH] exec_cmd: system_path memory leak fix 0xAX
2014-11-23 13:56 ` 0xAX
2014-11-23 14:01 ` 0xAX
2014-11-23 18:51 ` Junio C Hamano
2014-11-23 19:06 ` Alex Kuleshov
2014-11-23 19:19 ` Alex Kuleshov
2014-11-23 19:42 ` Jeff King
2014-11-23 20:07 ` Eric Sunshine
2014-11-23 21:58 ` Junio C Hamano
2014-11-24 7:02 ` Alex Kuleshov
2014-11-24 7:37 ` Junio C Hamano
2014-11-24 8:12 ` Alex Kuleshov [this message]
2014-11-24 13:11 ` Alexander Kuleshov
2014-11-24 14:00 ` Alex Kuleshov
2014-11-24 14:07 ` [PATCH] change contract between system_path and it's callers 0xAX
2014-11-24 19:33 ` Re*: " Junio C Hamano
2014-11-24 19:53 ` Alex Kuleshov
2014-11-24 20:20 ` Junio C Hamano
2014-11-24 20:50 ` Junio C Hamano
2014-11-25 6:45 ` Alexander Kuleshov
2014-11-25 7:04 ` Alexander Kuleshov
2014-11-25 17:55 ` Junio C Hamano
2014-11-25 18:03 ` Alexander Kuleshov
2014-11-25 18:24 ` [PATCH 1/1] " Alexander Kuleshov
2014-11-25 21:13 ` Junio C Hamano
2014-11-26 3:53 ` Alexander Kuleshov
2014-11-26 9:42 ` Alexander Kuleshov
2014-11-26 14:00 ` Alexander Kuleshov
2014-11-26 17:53 ` Junio C Hamano
2014-11-28 13:09 ` Philip Oakley
2014-11-25 20:20 ` Re*: [PATCH] " Junio C Hamano
2014-11-25 17:59 ` Alexander Kuleshov
2014-11-23 18:28 ` GIT: [PATCH] exec_cmd: system_path memory leak fix Junio C Hamano
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=87lhn1au67.fsf@gmail.com \
--to=kuleshovmail@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
--cc=sunshine@sunshineco.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;
as well as URLs for NNTP newsgroup(s).