Re: [PATCH 09/15] http: release the memory of a http pack request as well
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 24, 2015, 17:48 UTC
- Message-ID
- <xmqqh9ta70dc.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <CAGZ79kZbe9d7wG+CJ0o93hDs3sFjkSp68pBHXpjOysbzgvjo3w@mail.gmail.com>
Stefan Beller <sbeller@google.com> writes:
Show 5 quoted lines
> Well there is hope, as `release_request` only touches > free(request->url); > free(request); > > and not the userData pointer.
OK.
> I am a bit puzzled what you're trying to hint at.
The caller does this:
static void start_fetch_packed(struct transfer_request *request)
{
...
preq = new_http_pack_request(target, repo->url);
...
preq->slot->callback_func = process_response;
preq->slot->callback_data = request;
request->slot = preq->slot;
request->userData = preq; /* Try to get the request started, abort the request on error */
request->state = RUN_FETCH_PACKED;
if (!start_active_slot(preq->slot)) {
fprintf(stderr, "Unable to start GET request\n");
release_http_pack_request(preq);
repo->can_update_info_refs = 0;
release_request(request);
}
}and start_active_slot() actually not just "starts" but calls curl_multi_perform() to do things, like calling process_response(), which has calls to release_{,http_pack_}request(). I didn't see those releases and the releases we see in the above (i.e. when !start) will not run at the same time (but I see it now ;-))
In short, not hinting at anything. I was genuinely having a hard time following the codeflow.