Re: Possibly solved invalid free() in git-remote-http from Git 1.7.2.1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 1, 2011 at 17:39, Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> wrote:
> On Mon, Aug 1, 2011 at 17:22, Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> wrote:
>> In case anyone would like to look into this I had this undiagnosed
>> free() error from git-remote-http in git version 1.7.2.1:
>
> Actually this is still an issue in master, CC-ing Tay who introduced
> this error.
>
> This evil hack would get around it most of the time, but would
> introduce another race condition:

*brainfart*. This would be better:

    diff --git a/http.c b/http.c
    index a1ea3db..c5da23a 100644
    --- a/http.c
    +++ b/http.c
    @@ -1298,7 +1298,7 @@ struct http_object_request
*new_http_object_request(const char *base_url,
                            if (ftruncate(freq->localfile, 0) < 0) {
                                    error("Couldn't truncate temporary
file %s: %s",
                                              freq->tmpfile, strerror(errno));
    -                               goto abort;
    +                               goto abort_url;
                            }
                    }
            }
    @@ -1328,9 +1328,10 @@ struct http_object_request
*new_http_object_request(const char *base_url,

            return freq;

    +abort_url:
    +       free(freq->url);
     abort:
            free(filename);
    -       free(freq->url);
            free(freq);
            return NULL;
     }
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]