Jeff King <peff@xxxxxxxx> writes: > Coverity complains here of a leak of the xstrdup(). The return from > mkdtemp() should generally point to the same buffer we passed in, but if > it sees an error it will return NULL and the new heap buffer will be > lost. > > Probably unlikely, but since you are on a leak-checking kick, I thought > I'd mention it. ;) > > Since you have a writable strbuf already, maybe: > > new_gitdir = mkdtemp(buf.buf); > if (!new_gitdir) > ... > new_gitdir = strbuf_detach(&buf, NULL); /* same pointer, but now we own it */ > > Or since "buf" is not used for anything else, we could just leave it > attached to the strbuf. And probably give it a better name. Maybe: > ... Hmph, I think this is the second one we want to amend on the topic and it seems that I merged it a bit too prematurely. I do not mind reverting the topic out of 'next' and actually would prefer replacing it with a corrected version, which would allow us to merge the clean copy to the next release. Thanks.