From: list at eworm.de (Christian Hesse)
Subject: [PATCH 1/2] ui-stats: free without condition
Date: Mon, 12 Oct 2015 11:14:53 +0200 [thread overview]
Message-ID: <20151012111453.7eb07d73@leda.localdomain> (raw)
In-Reply-To: <20151012091012.GA19802@serenity.lan>
John Keeping <john at keeping.me.uk> on Mon, 2015/10/12 10:10:
> On Mon, Oct 12, 2015 at 10:59:34AM +0200, Christian Hesse wrote:
> > From: Christian Hesse <mail at eworm.de>
> >
> > xstrdup() returns allocated memory or NULL. It's safe to call free()
> > without condition.
> >
> > Coverity-Id 13839 is kind of false posivtive, but this should fix it
> > nevertheless.
> >
> > Coverity-Id: 13839
> > Signed-off-by: Christian Hesse <mail at eworm.de>
> > ---
> > ui-stats.c | 6 ++----
> > 1 file changed, 2 insertions(+), 4 deletions(-)
>
> This is wrong - we don't have strdup_strings set in the string_list so
> it takes ownership of the pointer. The test on item->util is used as a
> proxy testing if the entry is newly added to the list (in which case it
> has taken ownership of the string) or not (in which case we must free
> the string).
My assumption was that string_list_insert() handles this itself and
duplicates the string. Then please ignore the patches! :D
--
main(a){char*c=/* Schoene Gruesse */"B?IJj;MEH"
"CX:;",b;for(a/* Chris get my mail address: */=0;b=c[a++];)
putchar(b-1/(/* gcc -o sig sig.c && ./sig */b/42*2-3)*42);}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://lists.zx2c4.com/pipermail/cgit/attachments/20151012/1b46108f/attachment.asc>
next prev parent reply other threads:[~2015-10-12 9:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-12 8:59 list
2015-10-12 8:59 ` [PATCH 2/2] ui-stats: do not duplicate string list
2015-10-12 9:11 ` john
2015-10-12 9:10 ` [PATCH 1/2] ui-stats: free without condition john
2015-10-12 9:14 ` list [this message]
2015-10-12 18:29 ` list
2015-10-12 20:29 ` john
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=20151012111453.7eb07d73@leda.localdomain \
--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).