Christian Hesse <l...@eworm.de> on Mon, 2015/10/12 11:14: > John Keeping <j...@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 <m...@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 <m...@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
Does it make sense to set authors.strdup_strings = 1; items.strdup_strings = 1; and let string_list_insert() make the work? -- 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);}
pgpeLJhXK2Emy.pgp
Description: OpenPGP digital signature
_______________________________________________ CGit mailing list CGit@lists.zx2c4.com http://lists.zx2c4.com/mailman/listinfo/cgit