Re: What's cooking in git.git (Jun 2024, #01; Mon, 3)
Jeff King <peff@peff.net> writes:
> Weirdly, with ps/no-writable-strings merged (but without the fix
> above applied yet), SANITIZE=leak does not seem to find the leak
> anymore! Even though I can confirm in a debugger or by printing the
> strbuf's fields that it is still there. So that's...odd.
Yeah, that is what had me puzzled ;-)
Show 15 quoted lines
> if (all_msgs.len == 0) {
> fprintf(stderr, "nothing to send\n");
> + strbuf_release(&all_msgs);
> return 1;
> }
>
> total = count_messages(&all_msgs);
> if (!total) {
> fprintf(stderr, "no messages to send\n");
> return 1;
> }
>
> But I wonder if strbuf_read() should handle the allocation itself when
> it does a 0-byte read. We already do so for an error return (so the
> "could not read from stdin" path above is actually OK).