From: Adrian Ratiu Date: Fri, 20 Feb 2026 12:42:29 GMT Subject: Re: [PATCH v2 1/8] hook: add internal state alloc/free callbacks Message-ID: <87ikbry4ay.fsf@collabora.com> In-Reply-To: On Thu, 19 Feb 2026, Junio C Hamano wrote: > Adrian Ratiu writes: >> - >> - strbuf_init(&feed_ctx.buf, 0); >> + opt.feed_pipe_cb_data_alloc = transaction_feed_cb_data_alloc; >> + opt.feed_pipe_cb_data_free = transaction_feed_cb_data_free; >> >> ret = run_hooks_opt(transaction->ref_store->repo, "reference-transaction", &opt); >> >> - strbuf_release(&feed_ctx.buf); > > As the run_hooks_opt() machinery internally manages the > feed_pipe_cb_data, starting from the call to the custom alloc > function and concliding with the call to the custom free function, > this function no longer need to manage resources. Instead, the > custom alloc/free functions take care of all the associated > resources, like the feed_ctx.buf strbuf, as we have seen earlier. > > Nice. Exactly, yes. This reminds me: I need to verify the header files and the APIs to remove/update any comments about callers having to manage the these resources. Will do in v3.