From: Pierre Habouzit <madcoder@debian.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/2] Use xmemdup in many places.
Date: Wed, 19 Sep 2007 10:26:11 +0200 [thread overview]
Message-ID: <20070919082611.GE28205@artemis.corp> (raw)
In-Reply-To: <7v6427qdqr.fsf@gitster.siamese.dyndns.org>
[-- Attachment #1: Type: text/plain, Size: 2109 bytes --]
On Wed, Sep 19, 2007 at 08:08:12AM +0000, Junio C Hamano wrote:
> Pierre Habouzit <madcoder@debian.org> writes:
>
> > Signed-off-by: Pierre Habouzit <madcoder@debian.org>
> > ---
> > attr.c | 7 +------
> > builtin-add.c | 8 ++------
> > builtin-apply.c | 11 ++---------
> > builtin-fetch--tool.c | 6 +-----
> > builtin-fmt-merge-msg.c | 17 ++++++-----------
> > builtin-for-each-ref.c | 40 +++++++++-------------------------------
> > builtin-log.c | 12 ++----------
> > builtin-ls-files.c | 9 +--------
> > builtin-mv.c | 5 +----
> > builtin-revert.c | 4 +---
> > builtin-shortlog.c | 11 ++---------
> > commit.c | 16 ++++++----------
> > connect.c | 4 +---
> > convert.c | 7 +------
> > diff.c | 13 ++-----------
> > diffcore-order.c | 7 ++-----
> > fast-import.c | 4 +---
> > http-push.c | 9 ++-------
> > imap-send.c | 20 +++++---------------
> > merge-recursive.c | 19 ++++---------------
> > refs.c | 12 ++++--------
> > sha1_file.c | 12 +++---------
> > tag.c | 4 +---
> > 23 files changed, 60 insertions(+), 197 deletions(-)
> > ...
> > diff --git a/builtin-apply.c b/builtin-apply.c
> > index 05011bb..900d0a7 100644
> > --- a/builtin-apply.c
> > +++ b/builtin-apply.c
> > @@ -293,11 +293,7 @@ static char *find_name(const char *line, char *def, int p_value, int terminate)
> > return def;
> > }
> >
> > - name = xmalloc(len + 1);
> > - memcpy(name, start, len);
> > - name[len] = 0;
> > - free(def);
> > - return name;
> > + return xmemdup(start, len);
> > }
>
> Did we start leaking "def" here?
Hmm I fear we are. that has to be fixed indeed.
--
·O· Pierre Habouzit
··O madcoder@debian.org
OOO http://www.madism.org
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2007-09-19 8:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-17 16:11 xmemdup patches Pierre Habouzit
2007-09-15 21:53 ` [PATCH 1/2] Add xmemdup that duplicates a block of memory, and NUL terminates it Pierre Habouzit
2007-09-15 22:32 ` [PATCH 2/2] Use xmemdup in many places Pierre Habouzit
2007-09-19 8:08 ` Junio C Hamano
2007-09-19 8:26 ` Pierre Habouzit [this message]
2007-09-17 16:14 ` xmemdup patches Pierre Habouzit
2007-09-17 16:39 ` Johannes Schindelin
2007-09-17 17:43 ` Pierre Habouzit
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070919082611.GE28205@artemis.corp \
--to=madcoder@debian.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).