From: hjemli at gmail.com (Lars Hjemli)
Subject: Fixes for several memory leaks
Date: Thu, 7 Apr 2011 12:15:19 +0200 [thread overview]
Message-ID: <BANLkTinajbgjMVFL3k60Vx5xzjibWC83Cg@mail.gmail.com> (raw)
In-Reply-To: <20110405085128.GA27120@blizzard>
On Tue, Apr 5, 2011 at 10:51, Lukas Fleischer <cgit at cryptocrack.de> wrote:
> On Sat, Apr 02, 2011 at 10:18:44PM +0200, Lukas Fleischer wrote:
>> I created patches for a whole bunch of memory leaks (probably around 100
>> leaks altogether) which mostly came up due to assigning newly allocated
>> strings (using xstrdupn() in most cases) to configuration strings
>> without free()'ing the previous pointer at all.
Thanks. Even though memleaks have been consciously ignored in cgit
(since it's a cgi app), I appreciate the cleanup which these paches
introduce.
>> Note that this doesn't
>> cover everything by far. There's a lot of more leaks (mainly with repo,
>> ref and commit handling) which I didn't have time to fix yet tho.
Well, it's not certain that we want to fix them...
>> Clone URL of my cgit working tree is [1], web interface of the "wip"
>> branch can be found on [2].
>>
>> [1] git://git.cryptocrack.de/cgit.git
>> [2] http://git.cryptocrack.de/cgit.git/?h=wip
The fix to trim_end() has a couple of alternate incarnations on the
list at the moment, we'll have to see which one ends up as preferred.
>
> Added some null pointer dereference fixes.
The fix to reencode() is probably a good safety measure for the future
(the bug cannot be triggered by current callers), but the right fix to
the issue found by clang-analyzer in cgit_print_diff() probably looks
like this:
+++ b/ui-diff.c
@@ -368,8 +368,10 @@ void cgit_print_diff(const char *new_rev, const char *old_r
return;
}
commit = lookup_commit_reference(new_rev_sha1);
- if (!commit || parse_commit(commit))
+ if (!commit || parse_commit(commit)) {
cgit_print_error(fmt("Bad commit: %s", sha1_to_hex(new_rev_sha1)
+ return;
+ }
if (old_rev)
get_sha1(old_rev, old_rev_sha1);
--
larsh
next prev parent reply other threads:[~2011-04-07 10:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-02 20:18 cgit
2011-04-05 8:51 ` cgit
2011-04-07 10:15 ` hjemli [this message]
[not found] ` <20110407103025.GA20089@blizzard>
2011-04-07 10:38 ` hjemli
2011-04-10 17:31 ` cgit
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=BANLkTinajbgjMVFL3k60Vx5xzjibWC83Cg@mail.gmail.com \
--to=cgit@lists.zx2c4.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).