From: Alex Riesen <raa.lkml@gmail.com>
To: "Shawn O. Pearce" <spearce@spearce.org>
Cc: Jim Meyering <jim@meyering.net>, git list <git@vger.kernel.org>
Subject: Re: [PATCH] use xstrdup, not strdup in ll-merge.c
Date: Mon, 15 Jun 2009 17:21:11 +0200 [thread overview]
Message-ID: <81b0412b0906150821x30eb621ctcddc7691192b5270@mail.gmail.com> (raw)
In-Reply-To: <20090615142648.GV16497@spearce.org>
2009/6/15 Shawn O. Pearce <spearce@spearce.org>:
> Alex Riesen <raa.lkml@gmail.com> wrote:
>> As much as I'd like to know as much as possible about why something
>> failed, I can't make a failure handling automatically simple (given the tools).
>> I do suggest using goto to handle this particular OOM (below), but it looks
>> almost too ugly. Maybe I am just paranoid, and am overdoing this particular
>> case.
>
> Yes, this is horrible. Its a huge amount of code for checking a
> strdup failure that is unlikely to occur out of a configuration file.
>
> Really, how big is that config file? It can't be so large that a
> strdup() is likely to run out of memory pulling a value from it.
Oh, I don't worry about config files being too big (it is noticeable
without this checks). I'm worried about our bugs triggering the
conditions where allocation routines return NULL, like heap corruption
which is hard to notice without valgrind.
>> The "goto oom" patch:
>
> NAK. We don't do this anywhere else in git. Please don't start now.
We'll have to start paying more attention to memory management sometime.
Although, this particular case may be not the best case for it.
prev parent reply other threads:[~2009-06-15 15:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-14 19:47 [PATCH] use xstrdup, not strdup in ll-merge.c Jim Meyering
2009-06-14 22:03 ` Alex Riesen
2009-06-15 8:02 ` Jim Meyering
2009-06-15 8:45 ` Alex Riesen
2009-06-15 9:23 ` Jim Meyering
2009-06-15 11:39 ` Alex Riesen
2009-06-15 11:49 ` Jim Meyering
2009-06-15 12:46 ` Alex Riesen
2009-06-15 14:26 ` Shawn O. Pearce
2009-06-15 15:21 ` Alex Riesen [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=81b0412b0906150821x30eb621ctcddc7691192b5270@mail.gmail.com \
--to=raa.lkml@gmail.com \
--cc=git@vger.kernel.org \
--cc=jim@meyering.net \
--cc=spearce@spearce.org \
/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).